W3C home > Mailing lists > Public > public-web-perf@w3.org > September 2013

Re: [ResourcePriorities] Error in example

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 12 Sep 2013 10:20:24 -0400
Message-ID: <5231CDA8.1010406@mit.edu>
To: Ivan Kotenkov <kotenkov@yandex-team.ru>
CC: public-web-perf@w3.org
On 9/12/13 4:15 AM, Ivan Kotenkov wrote:
> http://www.w3.org/TR/WebIDL/#dfn-read-only .
> "The attribute is read only if the readonly keyword is used before the
> attribute keyword.

This is talking about IDL attributes (properties of the JS object)

> I think, using setAttribute is a direct assignment

setAttribute sets a _content_ attribute, not an IDL attribute.  Please 
read up on the difference between the two.

> Next let's look at an example. As a developer of chromium-based browser
> I'll use chromium code as an example.
> /interface HTMLInputElement/ is defined in HTMLInputElement.idl. Among
> other attributes it has
> /readonly attribute boolean willValidate;/

Right, but it doesn't have a defined "willvalidate" content attribute at 
all.  As in, <input willvalidate="something"> has no efeect whatsoever.

> Now let's create a simple webpage that will try to change the attribute:

> /  input = document.getElementById('inp');/
> /  alert(input.willValidate);/
> /  input.setAttribute('willValidate', false);/
> /  alert(input.willValidate);/

That's because the content "willValidate" attribute and the IDL 
"willValidate" attribute are completely unrelated.  Try 
getAttribute("willValidate") after your setAttribute call.

> Also, grepping the *.idl files for 'readonly' gives us attributes that
> obviously should not be change by using setters, for example:
> /HTMLFormElement.idl:    readonly attribute HTMLCollection elements;/
> /HTMLFormElement.idl:    readonly attribute long length;/

Those don't correspond to content attributes either.

But the attribute we're discussing here _does_ correspond to a content 
attribute.  <script lazyload> is supposed to change the behavior of the 

Again, the real problem the spec has here is that it doesn't actually 
define the behavior of the "lazyload" IDL attribute.  It needs to do that.

Received on Thursday, 12 September 2013 14:21:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:01:21 UTC