Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow TextNodes to be split #56

Open
DaSourcerer opened this issue Apr 27, 2015 · 0 comments
Open

Allow TextNodes to be split #56

DaSourcerer opened this issue Apr 27, 2015 · 0 comments

Comments

@DaSourcerer
Copy link
Contributor

This could possibly address #4 and help with #9:

There is currently no good way to cleanly split the content of a TextNode into serveral nodes after parsing. Doing so is vital when dealing with smileys and/or standalone links as they are likely to clash when it comes to processing them through dedicated filters. and masking them later through the HTMLSafeVisitor. A rather pain-free approach would be to allow TextNodes themselves have children, which would involve:

  1. moving the appropriate logic out of ElementNode into Node;
  2. allow TextNodes to be split at arbitrary positions through a public method (e.g.: TextNode.insertNodeAt(int $position, Node $node[, int $length=1])

A welcome side-effect were that DocumentNode could extend either TextNode or even Node directly instead of being a descendant of ElementNode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant