Re: Improving the DOM; rev 2

On 11/21/11 5:17 AM, Mounir Lamouri wrote:
> This issue happened recently with input.list: it broke a few websites
> but as far as I know, most of them got fixed. However, I think it would
> be better to try to use .remove() and rename it if it happens to break
> everything.

Note that there is an important difference here between the issues 
caused by .list and the issue raised by Andy.

Andy's issue is that new code using the new methods could break for some 
elements.  In particular, I think forms and documents are the only nodes 
that do the random name lookup thing and could have issues with the new 
properties being shadowed by existing elements.

On the other han, the .list issue, which also applies to .remove() and 
company, is that any code like this:

   <script>function remove(id) { /* stuff */ }</script>
   <div onclick="remove(this.id)">Click me</div>

works right now but will break with this change.

This has already been an issue with .list, with .contextMenu (see 
https://bugzilla.mozilla.org/show_bug.cgi?id=701328 which bit some sort 
of intranet-facing web app), and is likely to happen any time we add any 
new properties on elements or documents.  The shorter the names, the 
more likely the compat issues.

Going forward, we should be encouraging authors to follow 
https://developer.mozilla.org/Writing_Forward_Compatible_Websites#Prefix_all_global_variable_access_in_onfoo_attributes_with_.E2.80.9Cwindow..E2.80.9D 
but getting there will take some work.  :(

-Boris

Received on Monday, 21 November 2011 12:57:02 UTC