kangax / jstests Goto Github PK
View Code? Open in Web Editor NEWVarious experiments with Javascript, HTML, CSS, etc.
Home Page: http://kangax.github.com/jstests/
Various experiments with Javascript, HTML, CSS, etc.
Home Page: http://kangax.github.com/jstests/
http://kangax.github.com/jstests/etago_delimiter_test/
The full algorithm is described in the HTML spec here and here, but it’s a little hard to read IMHO :)
Anyhow, HTML5^H now finally standardized the behavior that all browsers implemented in the first place (in spite of what HTML 4.01 prescribed):
This works — the alert message will be shown:
<script>document.write('<p></p>'); alert(1);</script>
This will prematurely close the <script>
element — the alert message won’t be shown:
<script>document.write('<script></script>'); alert(1);</script>
Again, this is how it has always worked in every browser (as your test case states).
It might be worth updating the page to mention that HTML5^H standardizes what you already discovered, i.e. that only the </script
sequence will terminate the <script>
element’s content (depending on the next character), and other </
sequences are fine and safe to use.
See #whatwg chat logs: http://krijnhoetmer.nl/irc-logs/whatwg/20110326#l-353
Update: I’ve published a much more detailed write-up including some interesting (IMHO) edge cases on my blog: http://mathiasbynens.be/notes/etago
Firefox 45 (next nightly train, should be built sometime today according to the calendar) has finally implemented innerText. It would be pretty cool to see what differences it has with current implementations.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.