Re: QSA, the problem with ":scope", and naming

2011-12-07 Thread Lachlan Hunt
On 2011-10-20 10:14, Sean Hogan wrote: The primary use-case for matchesSelector() has been event-delegation, and this is the same for matches(). More specifically, consider the following scenario: jQuery adds a new event registration method that uses event delegation to mimic the behavior of: $(

Re: QSA, the problem with ":scope", and naming

2011-11-15 Thread Lachlan Hunt
On 2011-11-15 15:13, Brian Kardell wrote: Right now, the spec does however handle that use case by doing this: document.querySelectorAll(":scope .foo", x); Where x is either an individual element, or an Array, NodeList or numerically indexed object containing 0 or more Elements. (It does how

Re: QSA, the problem with ":scope", and naming

2011-11-15 Thread Brian Kardell
> Right now, the spec does however handle that use case by doing this: > > document.querySelectorAll(":scope .foo", x); > > Where x is either an individual element, or an Array, NodeList or numerically indexed object containing 0 or more Elements. > > (It does however limit the result only to elem

Re: QSA, the problem with ":scope", and naming

2011-11-15 Thread Lachlan Hunt
On 2011-10-30 17:23, Tab Atkins Jr. wrote: If it's a NodeList (or something else that *subclasses* Array) we can do fun things like add .find to it, which returns the sorted union of calling .find on all the elements within it. Returning a plain Array doesn't let us do that. JS libraries more

Re: QSA, the problem with ":scope", and naming

2011-11-10 Thread Jonas Sicking
On Thu, Nov 10, 2011 at 11:33 PM, Jonas Sicking wrote: > On Thu, Nov 10, 2011 at 2:57 PM, Travis Leithead > wrote: >> This has been an interesting debate, but I'm still a little confused with >> the outcome (if any). >> >> Will someone summarize the current position on these issues: >> >> 1. Sho

Re: QSA, the problem with ":scope", and naming

2011-11-10 Thread Jonas Sicking
On Thu, Nov 10, 2011 at 2:57 PM, Travis Leithead wrote: > This has been an interesting debate, but I'm still a little confused with the > outcome (if any). > > Will someone summarize the current position on these issues: > > 1. Should "find()" and "findAll()" follow

Re: QSA, the problem with ":scope", and naming

2011-11-10 Thread Tab Atkins Jr.
On Thu, Nov 10, 2011 at 2:57 PM, Travis Leithead wrote: > This has been an interesting debate, but I'm still a little confused with the > outcome (if any). > > Will someone summarize the current position on these issues: > > 1. Should "find()" and "findAll()" follow

Re: QSA, the problem with ":scope", and naming

2011-11-10 Thread Travis Leithead
This has been an interesting debate, but I'm still a little confused with the outcome (if any). Will someone summarize the current position on these issues: 1. Should "find()" and "findAll()" follow

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Boris Zbarsky
On 10/31/11 9:32 PM, Charles Pritchard wrote: Structured cloning fails for NodeList, same as postMessage, because of circular structure. What circular structure? Structured clone can handle that. It fails because it's a host object (based on its [[Class]]) that's not whitelisted in the struc

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Charles Pritchard
On 10/31/11 7:25 PM, Alex Russell wrote: For JS, it just means having a working ".length" property (in all the ways that Arrays allow it to be used). Arrays are identical to other objects in all other respects. No, they're not. For example, off the top of my head, they get serialized differen

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Boris Zbarsky
On 10/31/11 7:25 PM, Alex Russell wrote: For JS, it just means having a working ".length" property (in all the ways that Arrays allow it to be used). Arrays are identical to other objects in all other respects. No, they're not. For example, off the top of my head, they get serialized differen

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Alex Russell
On Mon, Oct 31, 2011 at 2:18 PM, Charles Pritchard wrote: > On 10/31/11 2:03 PM, Cameron McCormack wrote: >> >> On 31/10/11 1:56 PM, Alex Russell wrote: >>> >>> Live NodeList instances don't need to be considered here. They're the >>> result of an API which generates them, and that API can be desc

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Alex Russell
On Mon, Oct 31, 2011 at 2:03 PM, Cameron McCormack wrote: > On 31/10/11 1:56 PM, Alex Russell wrote: >> >> Live NodeList instances don't need to be considered here. They're the >> result of an API which generates them, and that API can be described >> in terms of Proxies. No need to complicate Nod

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Cameron McCormack
On 31/10/11 2:18 PM, Charles Pritchard wrote: I don't understand what "real array" means, other than the prototype equivalence. There's also the [[DefineOwnProperty]] behaviour which is different from normal objects. That kind of behaviour doesn't *need* to be handled by making NodeLists "re

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Jonas Sicking
Ok, so we're down to not having full agreement on the following selectors: On Mon, Oct 31, 2011 at 1:55 PM, Alex Russell wrote: > On Fri, Oct 21, 2011 at 12:41 AM, Jonas Sicking wrote: >> e.findAll("body > :scope > div") > > 1, 2, 3, 4 > >> e.findAll("body > :scope > div, :scope") > > context, 1

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Charles Pritchard
On 10/31/11 2:03 PM, Cameron McCormack wrote: On 31/10/11 1:56 PM, Alex Russell wrote: Live NodeList instances don't need to be considered here. They're the result of an API which generates them, and that API can be described in terms of Proxies. No need to complicate NodeList or imply that we n

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Cameron McCormack
On 31/10/11 1:56 PM, Alex Russell wrote: Live NodeList instances don't need to be considered here. They're the result of an API which generates them, and that API can be described in terms of Proxies. No need to complicate NodeList or imply that we need a different type. Making NodeList instance

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Alex Russell
On Sun, Oct 30, 2011 at 1:23 PM, Rick Waldron wrote: > > > On Sat, Oct 29, 2011 at 11:28 PM, Cameron McCormack wrote: >> >> On 20/10/11 3:50 AM, Alex Russell wrote: >>> >>> I strongly agree that it should be an Array *type*, but I think just >>> returning a plain Array is the wrong resolution to

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Alex Russell
What Tab said = ) On Sun, Oct 30, 2011 at 9:23 AM, Tab Atkins Jr. wrote: > On Sat, Oct 29, 2011 at 8:28 PM, Cameron McCormack wrote: >> On 20/10/11 3:50 AM, Alex Russell wrote: >>> >>> I strongly agree that it should be an Array *type*, but I think just >>> returning a plain Array is the wrong

Re: QSA, the problem with ":scope", and naming

2011-10-31 Thread Alex Russell
On Fri, Oct 21, 2011 at 12:41 AM, Jonas Sicking wrote: > On Thu, Oct 20, 2011 at 2:33 PM, Lachlan Hunt > wrote: >> Not necessarily.  It depends what exactly it means for a selector to >> contain >> :scope for determining whether or not to enable the implied :scope >> behaviour.  Consider: >> >>  

Re: QSA, the problem with ":scope", and naming

2011-10-30 Thread Rick Waldron
On Sat, Oct 29, 2011 at 11:28 PM, Cameron McCormack wrote: > On 20/10/11 3:50 AM, Alex Russell wrote: > >> I strongly agree that it should be an Array *type*, but I think just >> returning a plain Array is the wrong resolution to our NodeList >> problem. WebIDL should specify that DOM List types

Re: QSA, the problem with ":scope", and naming

2011-10-30 Thread Sean Hogan
On 30/10/11 2:28 PM, Cameron McCormack wrote: On 20/10/11 3:50 AM, Alex Russell wrote: I strongly agree that it should be an Array *type*, but I think just returning a plain Array is the wrong resolution to our NodeList problem. WebIDL should specify that DOM List types *are* Array types. It's i

Re: QSA, the problem with ":scope", and naming

2011-10-30 Thread Tab Atkins Jr.
On Sat, Oct 29, 2011 at 8:28 PM, Cameron McCormack wrote: > On 20/10/11 3:50 AM, Alex Russell wrote: >> >> I strongly agree that it should be an Array *type*, but I think just >> returning a plain Array is the wrong resolution to our NodeList >> problem. WebIDL should specify that DOM List types *

Re: QSA, the problem with ":scope", and naming

2011-10-29 Thread Cameron McCormack
On 20/10/11 3:50 AM, Alex Russell wrote: I strongly agree that it should be an Array *type*, but I think just returning a plain Array is the wrong resolution to our NodeList problem. WebIDL should specify that DOM List types *are* Array types. It's insane that we even have a NodeList type which i

Re: QSA, the problem with ":scope", and naming

2011-10-26 Thread Tab Atkins Jr.
On Wed, Oct 26, 2011 at 1:47 PM, Jonas Sicking wrote: > On Tue, Oct 25, 2011 at 10:43 AM, Yehuda Katz wrote: >> e.findAll("div, :scope") // 0,context,1,2,3,4,5,6 > > Huh, why 0 and 6? What's the logic there? I would have expected it to > be a sorted union of the results returned from the individu

Re: QSA, the problem with ":scope", and naming

2011-10-26 Thread Jonas Sicking
On Tue, Oct 25, 2011 at 10:43 AM, Yehuda Katz wrote: > Your guesses are all right in terms of existing jQuery but one: > 'div': [1, 2, 3, 4] > '': [] > '#3': [3] > '> div': [1, 2, 3] > '[foo=bar]': [] > '[id=1]': [1] > ':first-child': [1, 4] > '+ div': [5] > '~ div': [5, 6] Ah, yes, sounds good.

Re: QSA, the problem with ":scope", and naming

2011-10-26 Thread Brian Kardell
Yeah, I have to agree with the list here. If you allow one its unintuitive to not allow it the same way in a group. The more exceptions and complexity you add, the harder it is for someone to learn. On Oct 25, 2011 10:16 PM, "Bjoern Hoehrmann" wrote: > * Tab Atkins Jr. wrote: > >On Tue, Oct 2

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Bjoern Hoehrmann
* Tab Atkins Jr. wrote: >On Tue, Oct 25, 2011 at 4:56 PM, Ojan Vafai wrote: >> On Tue, Oct 25, 2011 at 4:44 PM, Bjoern Hoehrmann wrote: >>> * Tab Atkins Jr. wrote: >>> >Did you not understand my example?  el.find("+ foo, + bar") feels >>> >really weird and I don't like it.  I'm okay with a single

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Ojan Vafai
On Tue, Oct 25, 2011 at 4:58 PM, Tab Atkins Jr. wrote: > On Tue, Oct 25, 2011 at 4:56 PM, Ojan Vafai wrote: > > On Tue, Oct 25, 2011 at 4:44 PM, Bjoern Hoehrmann > wrote: > >> > >> * Tab Atkins Jr. wrote: > >> >Did you not understand my example? el.find("+ foo, + bar") feels > >> >really weird

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Sean Hogan
On 26/10/11 11:03 AM, Yehuda Katz wrote: fwiw, jQuery doesn't properly handle the comma-separated case, but this is most definitely a bug, caused by the naïve implementation that Alex showed early on in this thread. So no-one is actually using "+foo, +bar"? How common is "+foo" usage? Sean

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Yehuda Katz
fwiw, jQuery doesn't properly handle the comma-separated case, but this is most definitely a bug, caused by the naïve implementation that Alex showed early on in this thread. -- Yehuda On Tuesday, October 25, 2011, Tab Atkins Jr. wrote: > On Tue, Oct 25, 2011 at 4:56 PM, Ojan Vafai > > wrote: >

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Tab Atkins Jr.
On Tue, Oct 25, 2011 at 4:56 PM, Ojan Vafai wrote: > On Tue, Oct 25, 2011 at 4:44 PM, Bjoern Hoehrmann wrote: >> >> * Tab Atkins Jr. wrote: >> >Did you not understand my example?  el.find("+ foo, + bar") feels >> >really weird and I don't like it.  I'm okay with a single selector >> >starting wit

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Ojan Vafai
On Tue, Oct 25, 2011 at 4:44 PM, Bjoern Hoehrmann wrote: > * Tab Atkins Jr. wrote: > >Did you not understand my example? el.find("+ foo, + bar") feels > >really weird and I don't like it. I'm okay with a single selector > >starting with a combinator, like el.find("+ foo"), but not a selector >

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Bjoern Hoehrmann
* Tab Atkins Jr. wrote: >Did you not understand my example? el.find("+ foo, + bar") feels >really weird and I don't like it. I'm okay with a single selector >starting with a combinator, like el.find("+ foo"), but not a selector >list. Allowing "+ foo" but not "+ foo, + bar" would be "really weir

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Yehuda Katz
The CSS grammar (http://www.w3.org/TR/selectors/#w3cselgrammar) has a production for selector_group and selector. I would think that :scope would be prepended to each selector, not the entire selector group. -- Yehuda Katz On Tuesday, October 25, 2011, Tab Atkins Jr. wrote: > On Tue, Oct 25, 201

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Sean Hogan
On 26/10/11 9:28 AM, Tab Atkins Jr. wrote: On Tue, Oct 25, 2011 at 2:33 PM, Sean Hogan wrote: On 26/10/11 7:51 AM, Tab Atkins Jr. wrote: On Tue, Oct 25, 2011 at 1:47 PM, Sean Hogan wrote: I think allowing explicit :scope in findAll() will be perpetually confusing. I can imagine someone look

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Tab Atkins Jr.
On Tue, Oct 25, 2011 at 2:33 PM, Sean Hogan wrote: > On 26/10/11 7:51 AM, Tab Atkins Jr. wrote: >> On Tue, Oct 25, 2011 at 1:47 PM, Sean Hogan >>  wrote: >>> >>> I think allowing explicit :scope in findAll() will be perpetually >>> confusing. >>> I can imagine someone looking at old code like: >>>

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Yehuda Katz
The only case I can think of where explicit scope might be useful would be to filter out certain cases entirely: elem.findAll(":scope:visible div"); elem.findAll("#contents :scope [data-foo]") It's probably fine to just say that you should do a match first in that case, given the addition

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Sean Hogan
On 26/10/11 7:51 AM, Tab Atkins Jr. wrote: On Tue, Oct 25, 2011 at 1:47 PM, Sean Hogan wrote: I think allowing explicit :scope in findAll() will be perpetually confusing. I can imagine someone looking at old code like: e.findAll("div.foo span, div.bar :scope span") and asking themselves

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Tab Atkins Jr.
On Tue, Oct 25, 2011 at 1:47 PM, Sean Hogan wrote: > I think allowing explicit :scope in findAll() will be perpetually confusing. > I can imagine someone looking at old code like: > >     e.findAll("div.foo span, div.bar :scope span") > > and asking themselves "what's the rule again? If there's :s

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Sean Hogan
On 26/10/11 4:43 AM, Yehuda Katz wrote: Your guesses are all right in terms of existing jQuery but one: 'div': [1, 2, 3, 4] '': [] '#3': [3] '> div': [1, 2, 3] '[foo=bar]': [] '[id=1]': [1] ':first-child': [1, 4] '+ div': [5] '~ div': [5, 6] You can see the results live at http://jsfiddle.net/D

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Tab Atkins Jr.
On Tue, Oct 25, 2011 at 10:43 AM, Yehuda Katz wrote: > Your guesses are all right in terms of existing jQuery but one: > 'div': [1, 2, 3, 4] > '': [] > '#3': [3] > '> div': [1, 2, 3] > '[foo=bar]': [] > '[id=1]': [1] > ':first-child': [1, 4] > '+ div': [5] > '~ div': [5, 6] > You can see the resul

Re: QSA, the problem with ":scope", and naming

2011-10-25 Thread Yehuda Katz
Your guesses are all right in terms of existing jQuery but one: 'div': [1, 2, 3, 4] '': [] '#3': [3] '> div': [1, 2, 3] '[foo=bar]': [] '[id=1]': [1] ':first-child': [1, 4] '+ div': [5] '~ div': [5, 6] You can see the results live at http://jsfiddle.net/Dj3Ab/. The basic rule is that if there is

Re: QSA, the problem with ":scope", and naming

2011-10-23 Thread Sean Hogan
On 23/10/11 5:44 AM, Timmy wrote: On Oct 21, 2011, at 7:57 PM, Sean Hogan wrote: It was definitely not a design flaw in QSA. As Alex's sample code shows it is possible to get findAll() behavior using QSA. I think that further supports my argument. JS libraries have commonly considered this t

Re: QSA, the problem with ":scope", and naming

2011-10-22 Thread Timmy
On Oct 21, 2011, at 7:57 PM, Sean Hogan wrote: > It was definitely not a design flaw in QSA. As Alex's sample code shows it is > possible to get findAll() behavior using QSA. I think that further supports my argument. JS libraries have commonly considered this to be an oversight in the design of

Re: QSA, the problem with ":scope", and naming

2011-10-21 Thread Sean Hogan
On 20/10/11 12:39 AM, Timmy Willison wrote: >From the perspective of building a selector engine, I think all selector engines need something like .findAll, and not something like :scope. On Tue, Oct 18, 2011 at 8:00 PM, Alex Russell > wrote: No need to wait

Re: QSA, the problem with ":scope", and naming

2011-10-21 Thread Willison, Timothy
On Oct 20, 2011, at 4:34 PM, Tab Atkins Jr. wrote: > On Thu, Oct 20, 2011 at 12:09 PM, Jonas Sicking wrote: >> Let's do the general discussion about how live and non-live NodeLists >> should behave in a separate thread. > > Yes, let's. ^_^ > > >> The immediate question here is how should the

Re: QSA, the problem with ":scope", and naming

2011-10-21 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 2:33 PM, Lachlan Hunt wrote: > Not necessarily. It depends what exactly it means for a selector to contain > :scope for determining whether or not to enable the implied :scope > behaviour. Consider: > > foo.find(":not(:scope)"); Ooh, this is an interesting case too. So

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 5:15 PM, Tab Atkins Jr. wrote: If they *all* carry :scope, then you can just run them all over the whole tree and get the ordered set in the normal fashion. You can just prepend :scope to the ones missing it and run them over the whole tree too. But that means that now you're doi

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Tab Atkins Jr.
On Thu, Oct 20, 2011 at 2:33 PM, Lachlan Hunt wrote: > On 2011-10-20 22:32, Tab Atkins Jr. wrote: >> >> On Thu, Oct 20, 2011 at 7:23 AM, Boris Zbarsky  wrote: >>> >>> On 10/20/11 1:08 AM, Tab Atkins Jr. wrote: Basically, the presence of :scope would turn off *all* the limitations >>> >>>

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 22:32, Tab Atkins Jr. wrote: On Thu, Oct 20, 2011 at 7:23 AM, Boris Zbarsky wrote: On 10/20/11 1:08 AM, Tab Atkins Jr. wrote: Basically, the presence of :scope would turn off *all* the limitations That's a _really_ bizarre behavior. So in this case: foo.find(":scope + div,

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Tab Atkins Jr.
On Thu, Oct 20, 2011 at 2:04 PM, Boris Zbarsky wrote: > On 10/20/11 4:32 PM, Tab Atkins Jr. wrote: >> 1. Run the :scope-carrying selectors across the document together, >> automatically yielding a dom-ordered list. >> 2. Run the :scope-absent selectors together, automatically yielding a >> dom-ord

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 4:32 PM, Tab Atkins Jr. wrote: I don't really see the performance issues. If you use + or ~ off of :scope, you know for a fact that all the nodes come *after* any selectors that don't have :scope. Yes. 1. Run the :scope-carrying selectors across the document together, automatical

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Bjoern Hoehrmann
* Alex Russell wrote: >I strongly agree that it should be an Array *type*, but I think just >returning a plain Array is the wrong resolution to our NodeList >problem. WebIDL should specify that DOM List types *are* Array types. >It's insane that we even have a NodeList type which isn't a real array

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Tab Atkins Jr.
On Thu, Oct 20, 2011 at 12:09 PM, Jonas Sicking wrote: > Let's do the general discussion about how live and non-live NodeLists > should behave in a separate thread. Yes, let's. ^_^ > The immediate question here is how should the returned object from > .findAll behave? Should it be mutable? Sho

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Tab Atkins Jr.
On Thu, Oct 20, 2011 at 7:23 AM, Boris Zbarsky wrote: > On 10/20/11 1:08 AM, Tab Atkins Jr. wrote: >> >> I disagree.  It's extremely useful and natural for .find(":scope + >> div") to match sibling of the context node. > > I really don't think it is.  If you want that, use document.find(":scope +

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 7:23 AM, Alex Russell wrote: > On Thu, Oct 20, 2011 at 3:14 PM, Boris Zbarsky wrote: >> On 10/20/11 7:18 AM, Alex Russell wrote: >>> >>> No we don't. The fact that there's someone else who has a handle to >>> the list and can mutate it underneath you >> >> There is no sane

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 3:50 AM, Alex Russell wrote: > On Thu, Oct 20, 2011 at 6:55 AM, Jonas Sicking wrote: >> On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: >>> Lachlan and I have been having an...um...*spirited* twitter discussion >>> regarding querySelectorAll, the (deceased?) querySco

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 3:46 AM, Alex Russell wrote: >> However, it does seem like selectors are here to stay. And as much as >> they have shortcomings, people seem to really like them for querying. >> >> So with that out of the way, I agree that the CSS working group >> shouldn't be what is holdi

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Erik Arvidsson
On Thu, Oct 20, 2011 at 09:28, Boris Zbarsky wrote: > On 10/20/11 12:02 PM, Erik Arvidsson wrote: >> >> That is an ES violation. A non configurable, non writable data >> property is not allowed to change its value. > > It's not clear what that means in proxy-land; esp. since it's not clear > wheth

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 12:02 PM, Erik Arvidsson wrote: That is an ES violation. A non configurable, non writable data property is not allowed to change its value. It's not clear what that means in proxy-land; esp. since it's not clear whether proxies can even have non-configurable properties... or did th

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Erik Arvidsson
On Thu, Oct 20, 2011 at 04:49, Lachlan Hunt wrote: > On 2011-10-20 13:35, Sean Hogan wrote: >> >> I wonder if anyone is relying on querySelectorAll() returning a >> StaticNodeList? > > Only if there are people out there using list.item(n) instead of list[n], or > people extending the NodeList inte

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Erik Arvidsson
On Thu, Oct 20, 2011 at 04:37, Lachlan Hunt wrote: > On 2011-10-20 13:18, Alex Russell wrote: >> >> On Thu, Oct 20, 2011 at 12:05 PM, Lachlan Hunt >>  wrote: >>> >>> We need NodeList separate from Array where they are live lists. >> >> No we don't. The fact that there's someone else who has a hand

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Erik Arvidsson
On Thu, Oct 20, 2011 at 04:18, Alex Russell wrote: > No we don't. The fact that there's someone else who has a handle to > the list and can mutate it underneath you is a documentation issue, > not a question of type...unless the argument is that the slots should > be non-configurable, non-writable

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 16:23, Boris Zbarsky wrote: On 10/20/11 1:08 AM, Tab Atkins Jr. wrote: I disagree. It's extremely useful and natural for .find(":scope + div") to match sibling of the context node. I really don't think it is. If you want that, use document.find(":scope + div", context). Basical

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 10:23 AM, Alex Russell wrote: On Thu, Oct 20, 2011 at 3:14 PM, Boris Zbarsky wrote: Right. So you need to vend an apparently-immutable Array, one which can only be changed by the browser. I think that could be accomplished in terms of Proxies. But it's still an Array type. I have n

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 1:08 AM, Tab Atkins Jr. wrote: I disagree. It's extremely useful and natural for .find(":scope + div") to match sibling of the context node. I really don't think it is. If you want that, use document.find(":scope + div", context). Basically, the presence of :scope would turn o

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Alex Russell
On Thu, Oct 20, 2011 at 3:14 PM, Boris Zbarsky wrote: > On 10/20/11 7:18 AM, Alex Russell wrote: >> >> No we don't. The fact that there's someone else who has a handle to >> the list and can mutate it underneath you > > There is no sane way to mutate the list on the part of the browser if > someon

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 7:18 AM, Alex Russell wrote: No we don't. The fact that there's someone else who has a handle to the list and can mutate it underneath you There is no sane way to mutate the list on the part of the browser if someone else is also messing with it, because the someone else can viola

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Boris Zbarsky
On 10/20/11 6:50 AM, Alex Russell wrote: Oh, and as a separate issue. I think .findAll should return a plain old JS Array. Not a NodeList or any other type of host object. I strongly agree that it should be an Array *type*, but I think just returning a plain Array is the wrong resolution to our

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 10:49 PM, Lachlan Hunt wrote: On 2011-10-20 13:35, Sean Hogan wrote: I wonder if anyone is relying on querySelectorAll() returning a StaticNodeList? Only if there are people out there using list.item(n) instead of list[n], or people extending the NodeList interface and expecting s

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 13:35, Sean Hogan wrote: I wonder if anyone is relying on querySelectorAll() returning a StaticNodeList? Only if there are people out there using list.item(n) instead of list[n], or people extending the NodeList interface and expecting such methods to be available on the result.

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Tab Atkins Jr.
On Thu, Oct 20, 2011 at 3:39 AM, Alex Russell wrote: > There's a corner case I haven't formed an opinion on though: > >   el.find("div span :scope .whatevs"); > > ...does what? I think it's an error. ":scope" will need to occur in > the first term or not at all for .find(). Disagree. If :scope a

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 13:18, Alex Russell wrote: On Thu, Oct 20, 2011 at 12:05 PM, Lachlan Hunt wrote: We need NodeList separate from Array where they are live lists. No we don't. The fact that there's someone else who has a handle to the list and can mutate it underneath you is a documentation issue

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 10:05 PM, Lachlan Hunt wrote: On 2011-10-20 12:50, Alex Russell wrote: On Thu, Oct 20, 2011 at 6:55 AM, Jonas Sicking wrote: Oh, and as a separate issue. I think .findAll should return a plain old JS Array. Not a NodeList or any other type of host object. I strongly agree that it

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Brian Kardell
So I spoke with Borris about this at some length offline yesterday and was really shocked to discover that in the interest of supporting docs that do not conform, there appears to be 100% implementation agreement in CSS (and therefore qsa) that id selectors must match against all elements with the

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Alex Russell
On Thu, Oct 20, 2011 at 12:05 PM, Lachlan Hunt wrote: > On 2011-10-20 12:50, Alex Russell wrote: >> >> On Thu, Oct 20, 2011 at 6:55 AM, Jonas Sicking  wrote: >>> >>> Oh, and as a separate issue. I think .findAll should return a plain >>> old JS Array. Not a NodeList or any other type of host objec

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 12:50, Alex Russell wrote: On Thu, Oct 20, 2011 at 6:55 AM, Jonas Sicking wrote: Oh, and as a separate issue. I think .findAll should return a plain old JS Array. Not a NodeList or any other type of host object. I strongly agree that it should be an Array *type*, but I think jus

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Alex Russell
On Thu, Oct 20, 2011 at 6:55 AM, Jonas Sicking wrote: > On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: >> Lachlan and I have been having an...um...*spirited* twitter discussion >> regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, >> and ":scope". He asked me to continue he

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Alex Russell
On Thu, Oct 20, 2011 at 3:07 AM, Jonas Sicking wrote: > On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: >> Lachlan and I have been having an...um...*spirited* twitter discussion >> regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, >> and ":scope". He asked me to continue he

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Alex Russell
On Wed, Oct 19, 2011 at 7:01 PM, Lachlan Hunt wrote: > On 2011-10-19 16:08, Alex Russell wrote: >> >> On Wed, Oct 19, 2011 at 1:54 PM, Lachlan Hunt >>  wrote: >>> >>> I have attempted to address this problem before and the algorithm for >>> parsing a *scoped selector string* (basically what you're

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 8:42 PM, Lachlan Hunt wrote: On 2011-10-20 10:14, Sean Hogan wrote: The primary use-case for matchesSelector() has been event-delegation, and this is the same for matches(). More specifically, consider the following scenario: jQuery adds a new event registration method that uses eve

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 10:14, Sean Hogan wrote: The primary use-case for matchesSelector() has been event-delegation, and this is the same for matches(). More specifically, consider the following scenario: jQuery adds a new event registration method that uses event delegation to mimic the behavior of: $(

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 2:13 AM, Lachlan Hunt wrote: > On 2011-10-20 07:52, Jonas Sicking wrote: >> >> I'm not sure I understand what you are proposing here. Are you saying that >> >> >> >> :scope { >>   background: green; >> } >> >> >> >> should set the background of the  green? This does see

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 7:32 PM, Jonas Sicking wrote: On Thu, Oct 20, 2011 at 1:14 AM, Sean Hogan wrote: On 20/10/11 1:07 PM, Jonas Sicking wrote: On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: Lachlan and I have been having an...um...*spirited* twitter discussion regarding querySelectorAll, the

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Lachlan Hunt
On 2011-10-20 07:52, Jonas Sicking wrote: I'm not sure I understand what you are proposing here. Are you saying that :scope { background: green; } should set the background of the green? This does seem intuitive I agree, but it might also lead to strange behavior since the rendering of

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Timmy Willison
>From the perspective of building a selector engine, I think all selector engines need something like .findAll, and not something like :scope. On Tue, Oct 18, 2011 at 8:00 PM, Alex Russell wrote: > > No need to wait. We had something nearly identical for this in Dojo > using an ID prefix hack. It

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Jonas Sicking
On Thu, Oct 20, 2011 at 1:14 AM, Sean Hogan wrote: > On 20/10/11 1:07 PM, Jonas Sicking wrote: >> >> On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell >>  wrote: >>> >>> Lachlan and I have been having an...um...*spirited* twitter discussion >>> regarding querySelectorAll, the (deceased?) queryScopedSe

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 1:07 PM, Jonas Sicking wrote: On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: Lachlan and I have been having an...um...*spirited* twitter discussion regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, and ":scope". He asked me to continue here, so I'll try to ke

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Roland Steiner
On Thu, Oct 20, 2011 at 14:52, Jonas Sicking wrote: > > should (I think) have three cases: > > > > 1. Selector without :scope - same as .find > > 2. Selector with :scope - Same as #1, but also including the context > node. > > 3. Selector in @global - run the selector across the entire document,

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Roland Steiner
On Thu, Oct 20, 2011 at 14:08, Tab Atkins Jr. wrote: > should (I think) have three cases: > > 1. Selector without :scope - same as .find > 2. Selector with :scope - Same as #1, but also including the context node. > 3. Selector in @global - run the selector across the entire document, > filter t

Re: QSA, the problem with ":scope", and naming

2011-10-20 Thread Sean Hogan
On 20/10/11 5:41 PM, Jonas Sicking wrote: On Wed, Oct 19, 2011 at 11:14 PM, Sean Hogan wrote: I do however like the idea that if :scope appears in the selector, then this removes the prepending of ":scope " to that selector group. Is there a reason not to do that? 1. Already supported (in the

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Jonas Sicking
On Wed, Oct 19, 2011 at 11:14 PM, Sean Hogan wrote: >> I do however like the idea that if :scope appears in the selector, >> then this removes the prepending of ":scope " to that selector group. >> Is there a reason not to do that? > > 1. Already supported (in the draft spec) by querySelectorAll()

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Sean Hogan
On 20/10/11 1:07 PM, Jonas Sicking wrote: On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: Lachlan and I have been having an...um...*spirited* twitter discussion regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, and ":scope". He asked me to continue here, so I'll try to ke

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Jonas Sicking
On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell wrote: > Lachlan and I have been having an...um...*spirited* twitter discussion > regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, > and ":scope". He asked me to continue here, so I'll try to keep it > short: > > The rooted forms of

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Jonas Sicking
On Wed, Oct 19, 2011 at 10:08 PM, Tab Atkins Jr. wrote: > On Wed, Oct 19, 2011 at 7:22 PM, Ojan Vafai wrote: >> On Wed, Oct 19, 2011 at 7:07 PM, Jonas Sicking wrote: >>> .findAll("body > :scope > div")  // returns nothing >> >> Wouldn't this return ids 1,2,3 if we're not prepending :scope as you

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Jonas Sicking
On Wed, Oct 19, 2011 at 7:22 PM, Ojan Vafai wrote: > On Wed, Oct 19, 2011 at 7:07 PM, Jonas Sicking wrote: >> >> On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell >> wrote: >> > Lachlan and I have been having an...um...*spirited* twitter discussion >> > regarding querySelectorAll, the (deceased?) qu

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Tab Atkins Jr.
On Wed, Oct 19, 2011 at 7:22 PM, Ojan Vafai wrote: > On Wed, Oct 19, 2011 at 7:07 PM, Jonas Sicking wrote: >> .findAll("body > :scope > div")  // returns nothing > > Wouldn't this return ids 1,2,3 if we're not prepending :scope as you say > below? Yes, but he was answering those questions based

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Boris Zbarsky
On 10/19/11 10:07 PM, Jonas Sicking wrote: I like the general idea here. And since we're changing behavior, I think it's a good opportunity to come up with shorter names. Naming is really hard. The shorter names we use, the more likely it is that we're going to break webpages which are messing ar

Re: QSA, the problem with ":scope", and naming

2011-10-19 Thread Ojan Vafai
On Wed, Oct 19, 2011 at 7:07 PM, Jonas Sicking wrote: > On Tue, Oct 18, 2011 at 9:42 AM, Alex Russell > wrote: > > Lachlan and I have been having an...um...*spirited* twitter discussion > > regarding querySelectorAll, the (deceased?) queryScopedSelectorAll, > > and ":scope". He asked me to conti

  1   2   >