Giter Site home page Giter Site logo

Comments (10)

bzbarsky avatar bzbarsky commented on June 6, 2024

The spec seems to only define a "length" property for non-callback interfaces, implying that there is no such property on the NodeFilter object. So doing NodeFilter.length will return Function.prototype.length, which is 0.

That said, NodeFilter.hasOwnProperty("length") actually returns true in both Gecko and Blink.

from webidl.

Ms2ger avatar Ms2ger commented on June 6, 2024

I'm not sure where Function.prototype.length comes from, given

Remember that interface objects for callback interfaces only exist if they have constants declared on them; when they do exist, they are not function objects.

from webidl.

bzbarsky avatar bzbarsky commented on June 6, 2024

Oh. Well, NodeFilter.__proto__ == Function.prototype is true in both Gecko and Blink. Yes, that's not what IDL says right now. It's not clear to me why IDL says what it does and which should change.

from webidl.

nox avatar nox commented on June 6, 2024

@bzbarsky That condition is false in Safari.

from webidl.

nox avatar nox commented on June 6, 2024

Mentioning #78 because NodeFilter is the only legacy callback interface we have.

from webidl.

bzbarsky avatar bzbarsky commented on June 6, 2024

@nox What is it in IE? Seems to me like we should do the simplest thing that requires the fewest UAs to change.

from webidl.

nox avatar nox commented on June 6, 2024

@bzbarsky No idea, I don't have any Windows box. :(

from webidl.

domenic avatar domenic commented on June 6, 2024

NodeFilter.__proto__ === Function.prototype in latest Edge.

from webidl.

ArkadiuszMichalski avatar ArkadiuszMichalski commented on June 6, 2024

Hmm, more results for:

<script>
    console.log(NodeFilter.__proto__ == Function.prototype);
    console.log(typeof NodeFilter);
    console.log(NodeFilter.length);
    console.log(NodeFilter.hasOwnProperty("length"));
</script>

IE11: false, object, undefined, false
Opera 12.x: true, function, 0, false
Firefox and Chrome: true, function, 0, true

from webidl.

arronei avatar arronei commented on June 6, 2024

Edge: true, function, 0, false (length is a known Edge bug and should be true)

from webidl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.