Skip to content

Temporary Sizzle nodes trigger mutationObserver and no easy way to identify their nature. Related performance problems on running against different window. #4332

@exteon

Description

@exteon

Description

We are adding an element via jQuery to an inner frame (different window object) which is watched by a MutationObserver set on window.document.

When adding the element, a blank node with an id of #sizzle<numeric_id> is created on the document.

What is the documented purpose of this node? We would like to be able to either avoid its creation or a reliable way to determine its nature and ignore it (matching id against sizzle\d+ seems a bit contrived, undocumented and prone to break in the future...!?).

Searching for this revealed it's some internal functionality in jQuery related to supporting IE. However we are actually seing this in Chrome/FF so we are at a loss for any documentation of this behavior.

Update: the manipulations on these nodes seem to happen even in the most innocent-looking of operations, such as calling :is(':hidden') on any node. It's a storm of DOM changes for any operation.

Update2: We took a look at the jQuery source files and did some more behavior testing; it's apparent to us that Sizzle.setDocument() (which does this) is called on every invocation on any selector. There is no way this can not be a performance hog. Also we found it also creates <div></div> nodes without id directly in the document, so there is no way to tell the nature of the created nodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions