Re: [DOMCore] default value of id attribute

On 08/25/2011 02:06 AM, David Flanagan wrote:
> DOM Core §5.7 says:
>
>> The id attribute must return the result of invoking getAttribute()
>> with "id" as argument.
>
> And also says:
>
>> The getAttribute(name) method must run these steps:
>>
>> If the context object is in the HTML namespace and its node document
>> is an HTML document, let name be converted to ASCII lowercase.
>>
>> Return the value of the first attribute in the context object's
>> attributes whose qualified name is name, or null otherwise.
>
> So, for a newly created element e, with no "id" content attribute, e.id
> ought to be null.
>
> But this contradicts HTML §2.8.1:
>> In general, on getting, if the content attribute is not present, the
>> IDL attribute must act as if the content attribute's value is the
>> empty string;
> And it also contradicts the behavior of Firefox, Chrome and Safari (at
> least) in which document.createElement("div").id is "" instead of null.

Fixed: <http://dvcs.w3.org/hg/domcore/rev/5a5df3db5333>

Thanks
Ms2ger

Received on Friday, 26 August 2011 10:50:20 UTC