Rodolfo Grave | 2 Aug 2004 18:31
Picon
Picon
Favicon

Why "undefined" attributes of a tag are not accessible through DOM?

Hi.

I have the following simple code:

<span customAtt="customAttValue" 
onclick="document.write(this.customAtt)">content</span>

I expected it to show "customAttValue" but it shows "undefined" instead! 
It works just fine on IE.

Doesn't Mozilla support undefined attributes to be accessed through DOM? 
Is there a work-around to this? I really need to use custom attributes 
on my page.

RODOLFO
Christian Biesinger | 2 Aug 2004 19:36
Picon

Re: Why "undefined" attributes of a tag are not accessible through DOM?

Rodolfo Grave wrote:
> <span customAtt="customAttValue" 
> onclick="document.write(this.customAtt)">content</span>

use document.write(this.getAttribute("customAtt"));

attributes are not generally reflected as properties on the JS object.
Pascal Chevrel | 2 Aug 2004 20:17
Picon
Favicon

Re: document.all and TEch Evangeslism in Bugzilla : first result


Le 30/07/2004 00:27, Brendan Eich a ecrit :
> 
> 
> Thanks for your work here.  I'd like to encourage you to continue.  If 
> you need a mozilla.org project page, newsgroup, or anything else of the 
> same order, let me know.

Thank you for your offer Brendan, for the moment I am doing most of the 
checking job, I had a couple of friends giving me a hand with a few 
sites but I don't think they will continue in the long run.

For the moment I am just cleaning up the database, I think that once 
it's done we can think of perhaps doing it in a more formal and 
organized way, perhaps we could also do it through or with Mozilla 
Europe since I am a moz.eu staff member and one of the only persons I 
know still doing Tech Evangelism regularly (Mat) is also a mozilla 
europe member.

So far I checked 650 bug reports, here are the current results :

WFM/INVALID/DUPE 	: 255
Broken with doc.all	: 368
Working with doc.all 	:  16

(about 10 bugs I couldn't check because they required a login).

That's 4.3% of sites working now. French, Spanish, Portuguese, Italian 
and English:other components are finished. I will continue with 
Scandinavian languages since I can roughly read them, I am leaving the 
(Continue reading)

Frank Wein | 2 Aug 2004 21:26
Picon
Picon

Re: document.all and TEch Evangeslism in Bugzilla : first result

Pascal Chevrel wrote:
> Le 30/07/2004 00:27, Brendan Eich a ecrit :
>> Thanks for your work here.  I'd like to encourage you to continue.  If 
>> you need a mozilla.org project page, newsgroup, or anything else of 
>> the same order, let me know.
> 
> Thank you for your offer Brendan, for the moment I am doing most of the 
> checking job, I had a couple of friends giving me a hand with a few 
> sites but I don't think they will continue in the long run.
> 
> For the moment I am just cleaning up the database, I think that once 
> it's done we can think of perhaps doing it in a more formal and 
> organized way, perhaps we could also do it through or with Mozilla 
> Europe since I am a moz.eu staff member and one of the only persons I 
> know still doing Tech Evangelism regularly (Mat) is also a mozilla 
> europe member.
> 
> So far I checked 650 bug reports, here are the current results :

One question: So you marked every bug in that mentioned components now 
with [bug248549notfixed] or [bug248549fixed]? Since i found some bugs 
which were marked like that but actually had nothing to do with 
document.all at all.

Frank
Rodolfo Grave | 3 Aug 2004 00:04
Picon
Picon
Favicon

Re: Why "undefined" attributes of a tag are not accessible through DOM?

Great! It worked for Mozilla and IE! Thanks a lot for your reply.

Anyway, on IE I can access the attributes as a property of the JS 
object. So, when you say "are not GENERALLY reflected as properties on 
the JS object" are you saying that this is not part of the DOM 
specification?

I went to W3C to check it out.

This is from the DOM 1 specification at W3C... it's not quite clear to 
me, but after reading DOM 3 specification I think it reads that 
attributes must be accessible as properties of the JS Object. Am I 
wrong? I personally prefer the properties variant.

Fragment from W3C DOM 1 Specification:

http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/DOM.pdf

-----------------------------------------------
2.5. HTML Elements
2.5.1. Property Attributes

HTML attributes are exposed as properties on the element object. The DOM 
naming conventions always determine the name of the exposed property, 
and is independent of the case of the attribute in the source document. 
The data type of the property is determined by the type of the attribute 
as determined by the HTML 4.0 transitional and frameset DTDs. The 
attributes have the semantics (including case-sensitivity)given in the 
HTML 4.0 specification.

(Continue reading)

Justin Wood | 3 Aug 2004 00:16
Picon
Favicon

Re: Why "undefined" attributes of a tag are not accessible through DOM?

Rodolfo Grave wrote:

> Great! It worked for Mozilla and IE! Thanks a lot for your reply.
> 
> Anyway, on IE I can access the attributes as a property of the JS 
> object. So, when you say "are not GENERALLY reflected as properties on 
> the JS object" are you saying that this is not part of the DOM 
> specification?
> 
> I went to W3C to check it out.
> 
> This is from the DOM 1 specification at W3C... it's not quite clear to 
> me, but after reading DOM 3 specification I think it reads that 
> attributes must be accessible as properties of the JS Object. Am I 
> wrong? I personally prefer the properties variant.
> 
> Fragment from W3C DOM 1 Specification:
> 
> http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/DOM.pdf
> 
> -----------------------------------------------
> 2.5. HTML Elements
> 2.5.1. Property Attributes
> 
> HTML attributes are exposed as properties on the element object. The DOM 
> naming conventions always determine the name of the exposed property, 
> and is independent of the case of the attribute in the source document. 
> The data type of the property is determined by the type of the attribute 
> as determined by the HTML 4.0 transitional and frameset DTDs. The 
> attributes have the semantics (including case-sensitivity)given in the 
(Continue reading)

Christian Biesinger | 3 Aug 2004 01:01
Picon

Re: Why "undefined" attributes of a tag are not accessible through DOM?

Rodolfo Grave wrote:
> http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/DOM.pdf

This is a 2000 Working Draft, and thus no official recommendation. I 
can't find any final version of "DOM Level 1 (Second Edition)" what that 
document claims to be...

Although DOM 2 HTML does includes this too:
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-642250288

However, that entire chapter seems to refer only to attributes specified 
by HTML; for example, where it refers to "the datatype is determined by 
the DTD".

Not to mention that using attributes that are not part of the HTML 
standard produce an invalid document... and error handling is not 
specified by HTML (as opposed to XHTML, where it would fail to show the 
document).
Robin Lu | 3 Aug 2004 04:54
Picon

Re: Undetected document.all emulation

Brendan Eich <brendan <at> meer.net> wrote in message news:<4106BBB2.1070800 <at> meer.net>...
> 
> We support that for document.all only -- what made you think we do not?
> 
> Please don't reopen bugs, file follow-on bugs.  But not in this case.
> 
> /be

We found some collections other than document.all using () instead of
[] during our evaluation, which include:
  elements
  styleSheets
  children

robin
Brendan Eich | 3 Aug 2004 05:22

Re: Undetected document.all emulation

Robin Lu wrote:
> Brendan Eich <brendan <at> meer.net> wrote in message news:<4106BBB2.1070800 <at> meer.net>...
> 
>>We support that for document.all only -- what made you think we do not?
>>
>>Please don't reopen bugs, file follow-on bugs.  But not in this case.
>>
>>/be
> 
> 
> We found some collections other than document.all using () instead of
> [] during our evaluation, which include:
>   elements
>   styleSheets
>   children

How many sites, out of how many scanned?

Cc'ing bclary.

/be
bc | 3 Aug 2004 06:18

Re: Undetected document.all emulation

On 8/2/2004 11:22 PM, Brendan Eich wrote:
> Robin Lu wrote:
> 
>> Brendan Eich <brendan <at> meer.net> wrote in message 
>> news:<4106BBB2.1070800 <at> meer.net>...
>>
>>> We support that for document.all only -- what made you think we do not?
>>>
>>> Please don't reopen bugs, file follow-on bugs.  But not in this case.
>>>
>>> /be
>>
>>
>>
>> We found some collections other than document.all using () instead of
>> [] during our evaluation, which include:
>>   elements
>>   styleSheets
>>   children
> 
> 
> 
> How many sites, out of how many scanned?
> 
> Cc'ing bclary.
> 
> /be

MSIE treats "collections" simultaneously as arrays and functions where 
in many cases the "index" into the collection can be either a number or 
(Continue reading)


Gmane