<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Death to bad DOM Implementations</title>
	<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/</link>
	<description>It&#8217;s a work in progress</description>
	<pubDate>Fri, 25 Jul 2008 12:23:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0</generator>

	<item>
		<title>by: A better createElementWithName()</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-11784</link>
		<pubDate>Mon, 27 Aug 2007 15:50:28 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-11784</guid>
					<description>[...] Back in 2005, I wrote a piece about IE's abysmal generation of &lt;code&gt;NAME&lt;/code&gt;d elements via the DOM (which, interestingly enough, has proven to be one of the most popular posts on the blog, pointing to the fact that this is an obvious pain point for many DOM scripters out there). Since then, numerous improvements have been suggested, including the latest refactor [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Back in 2005, I wrote a piece about <abbr title="Internet Explorer">IE</abbr>&#8217;s abysmal generation of <code>NAME</code>d elements via the <abbr title="Document Object Model">DOM</abbr> (which, interestingly enough, has proven to be one of the most popular posts on the blog, pointing to the fact that this is an obvious pain point for many <abbr title="Document Object Model">DOM</abbr> scripters out there). Since then, numerous improvements have been suggested, including the latest refactor [&#8230;]
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: alt-tag.com</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-1582</link>
		<pubDate>Wed, 20 Dec 2006 18:34:48 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-1582</guid>
					<description>&lt;strong&gt;IE DOM Bugs...&lt;/strong&gt;

I&amp;#8217;ve been working on a Javascript project where it&amp;#8217;s necessary to create input elements (radio buttons and checkboxes) dynamically. With a functional DOM, it takes only a couple of lines of code, and works fine in Firefox and Safari. Too ba...</description>
		<content:encoded><![CDATA[<p><strong><abbr title="Internet Explorer">IE</abbr> <abbr title="Document Object Model">DOM</abbr> Bugs&#8230;</strong></p>
<p>I&#8217;ve been working on a Javascript project where it&#8217;s necessary to create input elements (radio buttons and checkboxes) dynamically. With a functional <abbr title="Document Object Model">DOM</abbr>, it takes only a couple of lines of code, and works fine in Firefox and Safari. Too ba&#8230;
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: wizardishungry/blog &#187; When to use Google to solve your problems and when to solve things yourself</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-1552</link>
		<pubDate>Tue, 12 Dec 2006 23:38:05 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-1552</guid>
					<description>[...] At work, I&amp;#8217;ve been working on a fairly complex AJAX application that melds the Prototype Javascript library with quite a bit of ad-hoc DOM manipulation. It worked fine in Firefox, but my DOM code silently failed in Internet Explorer, despite the AJAX request successfully reaching the server. Googling the various DOM functions turned up nothing but red herrings, so I fired up my Internet Explorer script debugger and decided to step through line by line. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] At work, I&#8217;ve been working on a fairly complex <abbr title="Asynchronus JavaScript and XML">AJAX</abbr> application that melds the Prototype Javascript library with quite a bit of ad-hoc <abbr title="Document Object Model">DOM</abbr> manipulation. It worked fine in Firefox, but my <abbr title="Document Object Model">DOM</abbr> code silently failed in Internet Explorer, despite the <abbr title="Asynchronus JavaScript and XML">AJAX</abbr> request successfully reaching the server. Googling the various <abbr title="Document Object Model">DOM</abbr> functions turned up nothing but red herrings, so I fired up my Internet Explorer script debugger and decided to step through line by line. [&#8230;]
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Mark Griffin</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-454</link>
		<pubDate>Sat, 06 May 2006 00:17:37 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-454</guid>
					<description>Ooops! Actually you can call function by simply say function() itself...</description>
		<content:encoded><![CDATA[<p>Ooops! Actually you can call function by simply say function() itself&#8230;
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Mark Griffin</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-453</link>
		<pubDate>Fri, 05 May 2006 23:16:27 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-453</guid>
					<description>document.createNamedElement = function(type, name) 

function createElementWithName()

This may be a silly question but how do you activate these functions?
That is how do you actually call them? I'm relatively new to javascript.
Normally you call a java funtion by simply var return = function()</description>
		<content:encoded><![CDATA[<p>document.createNamedElement = function(type, name) </p>
<p>function createElementWithName()</p>
<p>This may be a silly question but how do you activate these functions?<br />
That is how do you actually call them? I&#8217;m relatively new to javascript.<br />
Normally you call a java funtion by simply var return = function()
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Aaron</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-445</link>
		<pubDate>Wed, 03 May 2006 18:52:06 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-445</guid>
					<description>&lt;strong&gt;@bob:&lt;/strong&gt; Exactly my thinking and &lt;a href=&quot;#comment-444&quot; rel=&quot;nofollow&quot;&gt;Anthony beat me to the execution&lt;/a&gt;.

&lt;strong&gt;@pete:&lt;/strong&gt; It's been a while since I've done major JS surgery in IE, so I haven't been looking for tools, but when I need to read out what's been triggered and what hasn't to see where a script is failing, I usually use my homegrown app &lt;a href=&quot;http://easy-designs.net/code/jsTrace/&quot; rel=&quot;nofollow&quot;&gt;jsTrace&lt;/a&gt;.

&lt;strong&gt;@ anthony:&lt;/strong&gt; Thanks, that's great. I was planning to tackle the same thing myself, but ended up too bogged down to work on it. And, yes, I'd prefer the DOM method to add the &lt;code&gt;name&lt;/code&gt; as it's the most forward-compatible. Great work.</description>
		<content:encoded><![CDATA[<p><strong>@bob:</strong> Exactly my thinking and <a   href="#comment-444"   rel="nofollow">Anthony beat me to the execution</a>.</p>
<p><strong>@pete:</strong> It&#8217;s been a while since I&#8217;ve done major <abbr title="JavaScript">JS</abbr> surgery in <abbr title="Internet Explorer">IE</abbr>, so I haven&#8217;t been looking for tools, but when I need to read out what&#8217;s been triggered and what hasn&#8217;t to see where a script is failing, I usually use my homegrown app <a   href="http://easy-designs.net/code/jsTrace/"   rel="nofollow">jsTrace</a>.</p>
<p><strong>@ anthony:</strong> Thanks, that&#8217;s great. I was planning to tackle the same thing myself, but ended up too bogged down to work on it. And, yes, I&#8217;d prefer the <abbr title="Document Object Model">DOM</abbr> method to add the <code>name</code> as it&#8217;s the most forward-compatible. Great work.
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Anthony Lieuallen</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-444</link>
		<pubDate>Wed, 03 May 2006 18:08:52 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-444</guid>
					<description>Having just discovered this page, and seeing some very sensical comments, I came up with this version:

&lt;pre&gt;&lt;code&gt;function createElementWithName(){}
(function(){
  try {
    var el=document.createElement( '&amp;#60;div name=&quot;foo&quot;&amp;#62;' );
    if( 'DIV'!=el.tagName &amp;#124;&amp;#124;
        'foo'!=el.name ){
      throw 'create element error';
    }
    createElementWithName = function( tag, name ){
      return document.createElement( '&amp;#60;'+tag+' name=&quot;'+name+'&quot;&amp;#62;&amp;#60;/'+tag+'&amp;#62;' );
    }
  }catch( e ){
    createElementWithName = function( tag, name ){
      var el = document.createElement( tag );
      // setAttribute might be better here ?
      el.name = name;
      return el;
    }
  }
})();&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Having just discovered this page, and seeing some very sensical comments, I came up with this version:</p>
<pre><code>function createElementWithName(){}
(function(){
  try {
    var el=document.createElement( '&lt;div name="foo"&gt;' );
    if( 'DIV'!=el.tagName ||
        'foo'!=el.name ){
      throw 'create element error';
    }
    createElementWithName = function( tag, name ){
      return document.createElement( '&lt;'+tag+' name="'+name+'"&gt;&lt;/'+tag+'&gt;' );
    }
  }catch( e ){
    createElementWithName = function( tag, name ){
      var el = document.createElement( tag );
      // setAttribute might be better here ?
      el.name = name;
      return el;
    }
  }
})();</code></pre>]]></content:encoded>
				</item>
	<item>
		<title>by: Pete Moore</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-409</link>
		<pubDate>Mon, 01 May 2006 14:39:32 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-409</guid>
					<description>Thanks for posting this - f@#k IE - I also just spent several hours losing my mind trying to get to the bottom of this.  

I couldn't use the solutions above as I need to rename a copied DOM element.  The hack I ended up with was to mess with innerHTML, eg: 

&lt;code&gt;element.parentNode.innerHTML.replace(/sourceFormName/,'newFormName')&lt;/code&gt;

If anyone has a better suggestion, I'm all ears :)  

OT: I use FireBug with FireFox (if you don't have it, stop what you are doing and install it now). I can't help but thinking I could have saved the last several hours if I had an equivalent for IE ... any suggestions?</description>
		<content:encoded><![CDATA[<p>Thanks for posting this - f@#k <abbr title="Internet Explorer">IE</abbr> - I also just spent several hours losing my mind trying to get to the bottom of this.  </p>
<p>I couldn&#8217;t use the solutions above as I need to rename a copied <abbr title="Document Object Model">DOM</abbr> element.  The hack I ended up with was to mess with innerHTML, eg: </p>
<p><code>element.parentNode.innerHTML.replace(/sourceFormName/,'newFormName')</code></p>
<p>If anyone has a better suggestion, I&#8217;m all ears :)  </p>
<p>OT: I use FireBug with FireFox (if you don&#8217;t have it, stop what you are doing and install it now). I can&#8217;t help but thinking I could have saved the last several hours if I had an equivalent for <abbr title="Internet Explorer">IE</abbr> &#8230; any suggestions?
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Bob Ippolito</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-382</link>
		<pubDate>Wed, 26 Apr 2006 23:43:41 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-382</guid>
					<description>You really don't want to use an implementation that has to do the browser capability detection on every single createElementWithName call.  Instead you should do it once when *defining* the function.  Will be much faster and cleaner.</description>
		<content:encoded><![CDATA[<p>You really don&#8217;t want to use an implementation that has to do the browser capability detection on every single createElementWithName call.  Instead you should do it once when *defining* the function.  Will be much faster and cleaner.
</p>]]></content:encoded>
				</item>
	<item>
		<title>by: Aaron Campos</title>
		<link>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-341</link>
		<pubDate>Thu, 20 Apr 2006 00:00:56 +0000</pubDate>
		<guid>http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/#comment-341</guid>
					<description>Kind of redundant but since I ran into this too I figured I'd post the slight variation I used to get this to work using the Prototype.js Try.these() function:
&lt;pre&gt;function createElementWithName( type, name ){
  return Try.these(
    function(){
      return document.createElement('&amp;#60;'+type+' name=&quot;'+name+'&quot; /%gt;')
    },
    function(){
      var element = document.createElement(type);
      element.setAttribute( 'name', name );
      return element;
    } );
}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Kind of redundant but since I ran into this too I figured I&#8217;d post the slight variation I used to get this to work using the Prototype.js Try.these() function:</p>
<pre>function createElementWithName( type, name ){
  return Try.these(
    function(){
      return document.createElement('&lt;'+type+' name="'+name+'" /%gt;')
    },
    function(){
      var element = document.createElement(type);
      element.setAttribute( 'name', name );
      return element;
    } );
}</pre>]]></content:encoded>
				</item>
</channel>
</rss>
