Skip to content

Firefox considering text node valueChanged as added/removed node in Mutation Observer  #18

@gudipati

Description

@gudipati

In Firefox, mutation observer is considering textnode content change as added and removed.
since in tree-mirror.js we process nodes that are removed first and then process the one which are added, it result in textnode getting added multiple times. In Chrome, mutation observer considers the same textnode content change as valueChanged.

CHROME:
mutations- oldValue: oldText and target:text [data: newText, nodeName:#text, nodeValue: newText]
summaries- valueChanged:text [data: newText, nodeName:#text, nodeValue: newText]

FIREFOX:
mutations- [addedNodes 0: [data: newText, nodeName:#text, nodeValue: newText], removedNodes 0: [data: oldText, nodeName:#text, nodeValue: oldText]]
summaries- [added 0: [data: newText, nodeName:#text, nodeValue: newText], removed 0: [data: oldText, nodeName:#text, nodeValue: oldText]]

We have given both childList and subtree as true. I'm guessing chrome might be giving preference to subtree and hence returning oldValue/target while firefox might be giving preference to childList hence returning added/removed node. Am I right?

How do I make sure firefox picks it up as valueChanged instead of adding+removing the textnode? Can this be fixed here itself or should I do some kind of sequencing over the messages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions