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

Exclude <script> and <style> from Mojo::DOM text extraction #1502

Closed
wants to merge 1 commit into from

Conversation

kraih
Copy link
Member

@kraih kraih commented May 1, 2020

This came up on IRC recently, and everyone seemed to agree that excluding <script> and <style> would be the correct behaviour for Mojo::DOM::all_text.

@kraih
Copy link
Member Author

kraih commented May 1, 2020

Calling for a vote @mojolicious/core.

@kraih kraih added the vote label May 1, 2020
@shadowcat-mst
Copy link
Contributor

< kraih> everyone who agreed that it's the right behaviour better vote

Well, OK, since you insist.

@shadowcat-mst votes Monster Raving Loony Party

(also +1 for what little it's worth as a non-core contrib but I can't quite bring myself to spoil my ballot entirely)

@marcusramberg
Copy link
Member

I'm neutral to this change.

@CandyAngel
Copy link
Contributor

I think this would be better if the list of attributes to omit from all_text processing was an attribute. script and style seem like good defaults and it would allow for easy extension by the user (like if they had custom tags in their DOM) or clearing if they want the existing behaviour.

@kraih
Copy link
Member Author

kraih commented May 1, 2020

Quick disclaimer, i'm not going to modify this proposal. It is up for vote as is, and anyone is welcome to reuse the code for alternative proposals.

Copy link
Contributor

@Grinnz Grinnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I think this is a good idea to bring all_text closer to what would be expected of it.

@Grinnz
Copy link
Contributor

Grinnz commented May 1, 2020

@CandyAngel This sort of more extensible method could pretty easily be provided by a role or so, just possibly less efficient.

@kraih
Copy link
Member Author

kraih commented May 1, 2020

This change also does not prevent another PR with support for $dom->all_text({exclude => ['script', 'style']}) in the future.

@CandyAngel CandyAngel self-requested a review May 1, 2020 18:19
@CandyAngel
Copy link
Contributor

This seems like a useful change so I'm +1 on it, I just want it to be user controllable rather than hard-coded, which can be added in the future.

@jberger
Copy link
Member

jberger commented May 1, 2020

While in concept I agree with the spirit of this change, in xml mode should tags like script and style handled differently like this?

@Grinnz
Copy link
Contributor

Grinnz commented May 1, 2020

I agree, this exclusion should not occur in XML mode.

@kraih
Copy link
Member Author

kraih commented May 2, 2020

Since @Grinnz voted +1, yet raised concerns, i consider this vote failed. I will probably not be working on another attempt. So feel free to reuse whatever you want from this PR.

@kraih kraih closed this May 2, 2020
@kraih kraih deleted the script_style branch May 13, 2020 20:35
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

Successfully merging this pull request may close these issues.

6 participants