<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: DOMDom, easy DOM Element Creation</title>
	<atom:link href="http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/</link>
	<description></description>
	<pubDate>Thu, 04 Dec 2008 00:40:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Josh</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-815</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Fri, 13 Jun 2008 18:44:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-815</guid>
		<description>Surprised noone else ran into this.  I wanted to pass a sring as the parent to DOMDom.append when the template is compiled but compiledExecute does not handle that.  So on line 381 I added this block of code taken from elementExecute():

&lt;code&gt;
        if( parent )
        {
            if( ADAPTER.isString( parent ) ) parent = ADAPTER.get( parent );
            if( mode == MODE_REPLACE )
                parent.innerHTML = '';
        }
&lt;/code&gt;

And then I could pass the parent as a string and the world was whole again.  :)</description>
		<content:encoded><![CDATA[<p>Surprised noone else ran into this.  I wanted to pass a sring as the parent to DOMDom.append when the template is compiled but compiledExecute does not handle that.  So on line 381 I added this block of code taken from elementExecute():</p>
<p><code><br />
        if( parent )<br />
        {<br />
            if( ADAPTER.isString( parent ) ) parent = ADAPTER.get( parent );<br />
            if( mode == MODE_REPLACE )<br />
                parent.innerHTML = '';<br />
        }<br />
</code></p>
<p>And then I could pass the parent as a string and the world was whole again.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-336</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Wed, 25 Jul 2007 23:58:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-336</guid>
		<description>Hey vikas:

Unfortunately, I have not yet built that into DOMDom, but will certainly tackle it when I also complete some of the changes Klaus suggested.  Look for the next release soon!

Thanks, Zach</description>
		<content:encoded><![CDATA[<p>Hey vikas:</p>
<p>Unfortunately, I have not yet built that into DOMDom, but will certainly tackle it when I also complete some of the changes Klaus suggested.  Look for the next release soon!</p>
<p>Thanks, Zach</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zachleat.com {web} &#187; 8 Things the YUI Library Needs to Win Me Back</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-327</link>
		<dc:creator>zachleat.com {web} &#187; 8 Things the YUI Library Needs to Win Me Back</dc:creator>
		<pubDate>Wed, 25 Jul 2007 05:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-327</guid>
		<description>[...] Of course, I would have said easier operations on HTMLElement's, but the new YUI Element (Beta) Utility is doing wonders there. But how about some sort of DOM Creation class? Of course, I couldn't mention this without plugging the DOM Creation class I built for YUI called DOMDom. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Of course, I would have said easier operations on HTMLElement&#8217;s, but the new YUI Element (Beta) Utility is doing wonders there. But how about some sort of DOM Creation class? Of course, I couldn&#8217;t mention this without plugging the DOM Creation class I built for YUI called DOMDom. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vikas</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-316</link>
		<dc:creator>vikas</dc:creator>
		<pubDate>Wed, 18 Jul 2007 12:20:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-316</guid>
		<description>DomHelper has special code for table broken implementation on IE. IS that covered</description>
		<content:encoded><![CDATA[<p>DomHelper has special code for table broken implementation on IE. IS that covered</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus Hartl</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-304</link>
		<dc:creator>Klaus Hartl</dc:creator>
		<pubDate>Sat, 14 Jul 2007 16:54:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-304</guid>
		<description>That's the standards advocate in me speaking ;-)</description>
		<content:encoded><![CDATA[<p>That&#8217;s the standards advocate in me speaking ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus Hartl</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-303</link>
		<dc:creator>Klaus Hartl</dc:creator>
		<pubDate>Sat, 14 Jul 2007 16:50:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-303</guid>
		<description>Nonetheless it is invalid HTML. Scripting on top of an invalid DOM won't make your life easier and I don't see the point in promoting bad practice!</description>
		<content:encoded><![CDATA[<p>Nonetheless it is invalid HTML. Scripting on top of an invalid DOM won&#8217;t make your life easier and I don&#8217;t see the point in promoting bad practice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach Leatherman</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-302</link>
		<dc:creator>Zach Leatherman</dc:creator>
		<pubDate>Sat, 14 Jul 2007 15:51:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-302</guid>
		<description>@Stefan: thanks for the Dojo Port!

@Jack: Yeah, that syntax is less verbose, but I guess the intention of this class was to provide a syntax that minimized the amount of proprietary keywords in it.  Less documentation, as Klaus says.

@Klaus: Good suggestions!  I will definitely take those to heart.  I suppose the attribute list separated by comments is a leftover from my XPath days.  I see the W3 spec definitely agrees with you.

The style attribute is supported both ways you have listed there, and you can mix and match if you so choose (but I doubt anyone would)

With the child selectors, how you would you have siblings that would each have children?   I don't see anything in the CSS selector spec on nesting or parenthetical grouping.

div &#62; (span a) + (span a)

&#60;div&#62;&#60;span&#62;&#60;a/&#62;&#60;/span&#62;&#60;span&#62;&#60;a/&#62;&#60;/span&#62;&#60;/div&#62;

and not

div &#62; span a + span a

&#60;div&#62;&#60;span&#62;&#60;a/&#62;&#60;span&#62;&#60;a/&#62;&#60;/span&#62;&#60;/span&#62;&#60;/div&#62;


As a note to anyone reading, div span div does output as predicted in both DOM and HTML Fragment modes:

&#60;div&#62;&#60;span&#62;&#60;div&#62;&#60;/div&#62;&#60;/span&#62;&#60;/div&#62;</description>
		<content:encoded><![CDATA[<p>@Stefan: thanks for the Dojo Port!</p>
<p>@Jack: Yeah, that syntax is less verbose, but I guess the intention of this class was to provide a syntax that minimized the amount of proprietary keywords in it.  Less documentation, as Klaus says.</p>
<p>@Klaus: Good suggestions!  I will definitely take those to heart.  I suppose the attribute list separated by comments is a leftover from my XPath days.  I see the W3 spec definitely agrees with you.</p>
<p>The style attribute is supported both ways you have listed there, and you can mix and match if you so choose (but I doubt anyone would)</p>
<p>With the child selectors, how you would you have siblings that would each have children?   I don&#8217;t see anything in the CSS selector spec on nesting or parenthetical grouping.</p>
<p>div &gt; (span a) + (span a)</p>
<p>&lt;div&gt;&lt;span&gt;&lt;a/&gt;&lt;/span&gt;&lt;span&gt;&lt;a/&gt;&lt;/span&gt;&lt;/div&gt;</p>
<p>and not</p>
<p>div &gt; span a + span a</p>
<p>&lt;div&gt;&lt;span&gt;&lt;a/&gt;&lt;span&gt;&lt;a/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</p>
<p>As a note to anyone reading, div span div does output as predicted in both DOM and HTML Fragment modes:</p>
<p>&lt;div&gt;&lt;span&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus Hartl</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-296</link>
		<dc:creator>Klaus Hartl</dc:creator>
		<pubDate>Fri, 13 Jul 2007 09:11:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-296</guid>
		<description>Zach,

using selectors for DOM creation is &lt;em&gt;really slick&lt;/em&gt;!

We were discussing a port to jQuery and here are some ideas. For attribute creation I'd stick to correct CSS selector syntax:

&lt;code&gt;'input[name="myTextBox"][type="text"][maxlength="5"]'&lt;/code&gt;

instead of

&lt;code&gt;'input[name="myTextBox",type="text",maxlength="5"]'&lt;/code&gt;

And for inline styles why not using (seems to be more consistent to me):

'div[style="height: 80px; color: #f90; border: 1px solid #000;"]'

instead of

'div{height=80px,color=#f90,border=1px solid #000}' ? 

Pure CSS selectors could also be used for creating child elements:

&lt;code&gt;div &#62; span + span&lt;/code&gt;

instead of 

&lt;code&gt;{ 'div': [ 'span', 'span' ] }&lt;/code&gt;

Just a few ideas... The huge advantage I see with that is that one literally wouldn't have to remember anything special using the DOM creator if already familiar with CSS selectors. And you would have to write less documentation :-)

By the way, one of your examples is not very well chosen, the one with &lt;code&gt;'div span div'&lt;/code&gt;. A span element may not contain block level elements, thus the resulting DOM would not look like in the given example, but like the following due to browser tag soup parsers closing the span before the div starts:

&lt;code&gt;&#60;div&#62;
    &#60;span&#62;&#60;/span&#62;
    &#60;div&#62;&#60;/div&#62;
&#60;/div&#62;&lt;/code&gt;

Great work!</description>
		<content:encoded><![CDATA[<p>Zach,</p>
<p>using selectors for DOM creation is <em>really slick</em>!</p>
<p>We were discussing a port to jQuery and here are some ideas. For attribute creation I&#8217;d stick to correct CSS selector syntax:</p>
<p><code>'input[name="myTextBox"][type="text"][maxlength="5"]'</code></p>
<p>instead of</p>
<p><code>'input[name="myTextBox",type="text",maxlength="5"]'</code></p>
<p>And for inline styles why not using (seems to be more consistent to me):</p>
<p>&#8216;div[style=&#8221;height: 80px; color: #f90; border: 1px solid #000;&#8221;]&#8217;</p>
<p>instead of</p>
<p>&#8216;div{height=80px,color=#f90,border=1px solid #000}&#8217; ? </p>
<p>Pure CSS selectors could also be used for creating child elements:</p>
<p><code>div &gt; span + span</code></p>
<p>instead of </p>
<p><code>{ 'div': [ 'span', 'span' ] }</code></p>
<p>Just a few ideas&#8230; The huge advantage I see with that is that one literally wouldn&#8217;t have to remember anything special using the DOM creator if already familiar with CSS selectors. And you would have to write less documentation :-)</p>
<p>By the way, one of your examples is not very well chosen, the one with <code>'div span div'</code>. A span element may not contain block level elements, thus the resulting DOM would not look like in the given example, but like the following due to browser tag soup parsers closing the span before the div starts:</p>
<p><code>&lt;div&gt;<br />
    &lt;span&gt;&lt;/span&gt;<br />
    &lt;div&gt;&lt;/div&gt;<br />
&lt;/div&gt;</code></p>
<p>Great work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack Slocum</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-293</link>
		<dc:creator>Jack Slocum</dc:creator>
		<pubDate>Thu, 12 Jul 2007 21:37:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-293</guid>
		<description>Hi Zach,

As noted on Ajaxian, DomHelper has a less verbose syntax available if you don't like the default. 

Ext.DomHelper.append( myDiv, {
   style: 'width:100%;border:1px solid blue;',
   cls: 'testClass',
   cn: {tag: 'a', href: 'http://www.google.com/', cn: {tag: 'span', html: 'Google' }}
});</description>
		<content:encoded><![CDATA[<p>Hi Zach,</p>
<p>As noted on Ajaxian, DomHelper has a less verbose syntax available if you don&#8217;t like the default. </p>
<p>Ext.DomHelper.append( myDiv, {<br />
   style: &#8216;width:100%;border:1px solid blue;&#8217;,<br />
   cls: &#8216;testClass&#8217;,<br />
   cn: {tag: &#8216;a&#8217;, href: &#8216;http://www.google.com/&#8217;, cn: {tag: &#8217;span&#8217;, html: &#8216;Google&#8217; }}<br />
});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DOMDom: More DOM, Less DOM &#171; outaTiME</title>
		<link>http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-292</link>
		<dc:creator>DOMDom: More DOM, Less DOM &#171; outaTiME</dc:creator>
		<pubDate>Thu, 12 Jul 2007 16:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.zachleat.com/web/2007/07/07/domdom-easy-dom-element-creation/#comment-292</guid>
		<description>[...] More DOM, Less&#160;DOM Zach Leatherman has created another DOM creation class, DOMDom, (with support for HTML Fragments) that uses the CSS query language. But instead of using the [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] More DOM, Less&nbsp;DOM Zach Leatherman has created another DOM creation class, DOMDom, (with support for HTML Fragments) that uses the CSS query language. But instead of using the [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
