[Bug 27191] New: "callback interface NodeFilter"

[email protected]
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27191

            Bug ID: 27191
           Summary: "callback interface NodeFilter"
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DOM
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected], [email protected]

https://dom.spec.whatwg.org/#interface-nodefilter

[[
callback interface NodeFilter
]]

I think this is wrong, or at least confusing. Looking at
https://heycam.github.io/webidl/#dfn-callback-interface,

> Callback interfaces are ones that can be implemented by user objects and not by platform objects, as described in section 3.9 below. 

Also

> Static attributes and static operations MUST NOT be defined on a callback interface. 

Which doesn't specifically call out `const`s, but seems the same in spirit.

Additionally, while `window.NodeFilter` exists in all browsers,
`window.EventListener` does not, and earlier the spec declares `callback
interface EventListener` very similarly. I think (but am not sure) per WebIDL
callback interfaces don't exist globally.

Suggested correction, if I am understanding this correctly:

- Add a separate `interface NodeFilter` that shows up on the global, has
constants, and has an `acceptNode` method.
- Add `callback interface NodeFilterCallback` that contains only `acceptNode`
and is used by createNodeIterator and createTreeWalker.
- Specify that passing a `NodeFilterCallback` (which could just be a plain
function, per the definition of callback interfaces) to e.g. createNodeIterator
causes the creation of a new `NodeFilter` object that is reflected by the
`filter` property of the created node iterator.

Does this make sense? Am I on to something or just missing the idea entirely?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.