PDA

View Full Version : [OPEN] [CLOSED] Ext.query("*[class!=bar]") returns all nodes even with no "class" attribute



nosferatum
14 Jul 2010, 6:38 AM
In DomQuery documentation, it's told that:
E[foo!=bar] has an attribute "foo" that does not equal "bar",
but Ext.query("*[class!=bar]") returns ALL DOM elements having not class="bar", even those that
do not have any "class" attribute.
Result also contains <html>, <head>, <title>, <meta>, <link>, <style>, <script> elements,
and all dom elements with no class attribute.

It is also true for all E[foo!=bar] combinations (E not only '*', foo all correct and incorrect
attribute names and any bar value).

Jamie Avins
14 Jul 2010, 9:15 AM
Technically the behavior is correct, though it may not be what you're expecting. The biggest problem is that changing this behavior may break existing applications which rely on it.

nosferatum
14 Jul 2010, 10:56 AM
Then if it's correct behaviour, the correction has to be made to DomQuery API documentation.
It would also be good to add DomQuery attribute selector that'll be appropriate to now's documenation (has an attribute "foo" that does not equal "bar")

Jamie Avins
14 Jul 2010, 11:25 AM
I have updated that documentation to make it clearer. As far as adding a new selector, we really want to follow the QSA standards that are out there.

tryanDLS
14 Jul 2010, 11:43 AM
I have updated that documentation to make it clearer. As far as adding a new selector, we really want to follow the QSA standards that are out there.
I second that - the behavior (not the doc) matches what other libraries do. For example in jquery

$('*:not(".foo")') // returns ALL elements that don't have class=foo