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

Tags in javascript are being destroyed #117

Closed
irsdl opened this issue May 31, 2012 · 7 comments
Closed

Tags in javascript are being destroyed #117

irsdl opened this issue May 31, 2012 · 7 comments

Comments

@irsdl
Copy link

irsdl commented May 31, 2012

Hi,
I grabbed this sample from www.bbc.co.uk website (cookie confirmation section on top):

<script type="text/html" id="test">
<![CDATA[ <div id="mytag"> <h2> Test </h2> <p> We use cookies</p></div> ]]>
</script>

These tags will be completely destroyed if you try it in http://jsbeautifier.org/

@bitwiseman
Copy link
Member

Does anyone with more html experience have any thoughts on this? http://stackoverflow.com/questions/3302648/should-i-use-cdata-in-html5 seems to indicate that the correct way to do this is:

<script type="text/html" id="test">
//<![CDATA[ <div id="mytag"> <h2> Test </h2> <p> We use cookies</p></div> ]]>
</script>

@irsdl
Copy link
Author

irsdl commented Apr 23, 2013

Hi Mario and Gareth,
Do you have any opinion on this generally? 

Thanks
Soroush


From: Liam Newman [email protected]
To: einars/js-beautify [email protected]
Cc: irsdl [email protected]
Sent: Tuesday, 23 April 2013, 22:35
Subject: Re: [js-beautify] Tags in javascript are being destroyed (#117)

Does anyone with more html experience have any thoughts on this? http://stackoverflow.com/questions/3302648/should-i-use-cdata-in-html5 seems to indicate that the correct way to do this is:

<script type="text/html" id="test"> //

Test

We use cookies

]]> </script>


Reply to this email directly or view it on GitHub.

@einars
Copy link
Contributor

einars commented Apr 23, 2013

An usable solution would be to not really care for CDATA worm–can in this case and update html beautifier to attempt to determine the "type" attribute of the script tags, and leave everything intact if it's not text/javascript (or empty): currently all scripts are passed to js-beautifier as-is.

@irsdl
Copy link
Author

irsdl commented Apr 24, 2013

Sorry just found your email in a sea of gmail :D

CDATA is extremely important since it allows you to display entities "as
is" unfortunately there is a difference between standards and quirks and
svg and html. They are extremely useful when filtering SVG though because
inside a style you can prevent entities from working and causing undesired
results in your filter. I'd reply on stackoverflow but I don't have an
account.

On 23 April 2013 23:51, S.Dalili [email protected] wrote:

Hi Mario and Gareth,
Do you have any opinion on this generally?

Thanks
Soroush


From: Liam Newman [email protected]
To: einars/js-beautify [email protected]
Cc: irsdl [email protected]
Sent: Tuesday, 23 April 2013, 22:35
Subject: Re: [js-beautify] Tags in javascript are being destroyed (#117)

Does anyone with more html experience have any thoughts on this?
http://stackoverflow.com/questions/3302648/should-i-use-cdata-in-html5seems to indicate that the correct way to do this is:

<script type="text/html" id="test"> //

Test

We use cookies

]]> </script>


Reply to this email directly or view it on GitHubhttps://github.com//issues/117#issuecomment-16888071
.

@bitwiseman bitwiseman added this to the v1.5.2 milestone Sep 30, 2014
@bitwiseman
Copy link
Member

Looks like this now fixed.

@pdf
Copy link

pdf commented Jan 26, 2015

Looks like this is broken (still/again?)

@irsdl
Copy link
Author

irsdl commented Jan 26, 2015

I haven't changed the plugin but I will probably update it soon with new
features and new patches. Hopefully all the open issues will be resolved.

On Mon, Jan 26, 2015 at 11:33 AM, Peter Fern [email protected]
wrote:

Looks like this is broken (still/again?)


Reply to this email directly or view it on GitHub
#117 (comment)
.

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

No branches or pull requests

4 participants