- From: Anne van Kesteren <annevk@opera.com>
- Date: Wed, 03 Aug 2011 17:51:28 +0200
- To: "Glenn Maynard" <glenn@zewt.org>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, "Aryeh Gregor" <ayg@aryeh.name>, "Maciej Stachowiak" <mjs@apple.com>, "WebApps WG" <public-webapps@w3.org>
On Wed, 03 Aug 2011 17:46:50 +0200, Glenn Maynard <glenn@zewt.org> wrote: > What's the difference? ele.setAttribute(x, val) works on any element. ele[x] = val does not. They also behave differently for a large number of cases and the latter often takes values of a type other than DOMString. > I'd expect this: > > a = Element.create("a", {href: "http://link", onclick: function(e) { }, > custom: "value" }, "link"); > > to be essentially equivalent to > > a = document.createElement("a"); > a.appendChild(document.createTextNode("link")); > attrs = {href: "http://link", onclick: function(e) { }, custom: "value" > }; > for(key in attrs) a[key] = attrs[key]; Would you expect to write contenteditable as contenteditable or as contentEditable? Also, would you expect custom to end up as a content attribute on that <link> element? Because it will not with this code. -- Anne van Kesteren http://annevankesteren.nl/
Received on Wednesday, 3 August 2011 15:52:02 UTC