I don't believe DOM 1 requires setAttribute to produce an exception when it would be used to modify an attribute which is also exposed through a distinct property that happens to be readonly. I'd guess the implementation you refer to is taking an overly conservative view if it is producing an exception. If I were implementing this, I would distinguish the semantics of setAttribute for elements instantiated during the parsing process and those created explicitly in the DOM. For the former, I would preserve the readonly semantics for setAttribute implied by their corresponding properties in the HTML* interfaces; on the other hand, for those created explicitly, I would not restrict mutation. Regards, Glenn Adams ----- Original Message ----- From: "Adrian Cotter" <adrian.cotter@frogdesign.com> To: <www-dom@w3.org> Sent: Thursday, August 10, 2000 8:55 PM Subject: HTMLInputElement, type attribute (errata?) > Have a question regarding > > Interface HTMLInputElement > readonly attribute DOMString type; > http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-882764350 > > it seems strange that this attribute is read only. how is able to create a > "password" or "hidden" field as opposed to the "text" field, when this is > read only? > > if I do the following I would obviously get an error (as I do in Mac IE 5): > var formElement = document.createElement("INPUT"); > formElement.setAttribute("type","hidden"); > > I'm I missing something, or is there some other way to create a hidden or > password (or button,etc) element? > > thanks > > adrian cotter > developer > frogdesign > > > >Received on Friday, 11 August 2000 12:45:15 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 October 2009 08:24:52 GMT