Skip to content

Exception "NodeFilter is not defined" #101

Open
@arekdygas

Description

@arekdygas

I'm trying to create NodeIterator object using the following code

var config = Configuration.Default.WithJs();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(req => req.Content("")).ConfigureAwait(false);
document.ExecuteScript("document.createNodeIterator(document.body, NodeFilter.SHOW_ELEMENT, null)");

Running it causes the exception Jint.Runtime.JavaScriptException: 'NodeFilter is not defined' I see that FilterSettings enum has [DomName("NodeFilter")] attribute, and yet it is not visible in JS.

I tried to check where other DomName attributes are resolved and that led me to the CreatorCache, where enums and classes are treated in a different way, which might explain the problem. But being totally new to AngleSharp and AngleSharp.JS, maybe I miss something, e.g. some configuration switch, which forces NodeFilter to be registered in JS?

Versions:
AngleSharp & AngleSharp.JS: master
Jint: 4.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions