Closed Bug 635680 Opened 13 years ago Closed 13 years ago

fieldset.type used to be null and now is 'fieldset' (in Jägermonkey)

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: sindbili, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11
Build Identifier: 4.0b11

I'm not sure if its a bug or a new feature. In firefox 3.6, when you ask for a fieldset type property it returns null. But now, it returns "fieldset".

I realized that because I have this old script that runs doSomething on each input of a form (except type==button):
for(var i=0; i<pForm.elements.length; i++){
    var ele = pForm.elements[i];
    if(ele.type && ele.type!="button"){
        doSomething();
    }
}

In firefox4, my script fails on doSomething() because I didn't expect a fieldset there. Adding "&& ele.type!="fieldset" " fixes my problem.

This change in fieldset.type behaviour can cause problems to other users, and type isn't a w3c fieldset attribute... so, I don't know if it would be better to maintain old behaviour.

Thanks. 

Reproducible: Always
https://developer.mozilla.org/en/DOM/HTMLFieldSetElement
http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-fieldset-element

Introduced in bug 595447
Assignee: general → nobody
Component: JavaScript Engine → DOM: Core & HTML
QA Contact: general → general
This is what WHATWG HTML specs require:
http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-fieldset-type

But it seems like we are currently the only browser doing that. Given that it's the first bug report in nearly 6 months, I guess we can assume it's not a big web compat issue.
I'm going to mark this INVALID based on that but feel free to reopen if you think this is going to break a lot of websites.

By the way, you should assume that all listed form elements have a type IDL attribute.
Blocks: 595447
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.