Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:41:30+00:00 2026-05-29T23:41:30+00:00

Given other questions on the same topic I feel I understand the apparent justifications

  • 0

Given other questions on the same topic I feel I understand the apparent justifications for concatenating the <script> tag as '<scr'+'ipt..' in a javascript string, even if this itself is misguided.

However, looking at the code for the Instapaper bookmarklet I see d.createElement('scr' + 'ipt'). The relevant part of the code (beautified) is at the end of the question.

Even if this (anti-)pattern is to avoid the HTML parser balking at the markup after the occurrence of the closing <script> tag within a javascript string, I can see even less justification for doing it here given the concatenated text does not even represent a <script> tag.

In this case, is this done for some other reason?

javascript: function iprl5() {
    var d = document,
        z = d.createElement('scr' + 'ipt'),  //???
        b = d.body,
        l = d.location;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:41:32+00:00Added an answer on May 29, 2026 at 11:41 pm

    It is silly to escape "<script>" as it will not be parsed as tag inside a script block* and it is even sillier to treat "script" as special. It’s not. It lacks either a < or </, without which it will never be parsed as a tag — in any context. Thus f("script") and f("scr"+"ipt") have identical semantics.

    Technically in HTML, all </ in a script block need to be guarded against, but in practice browsers only care about </script>. Because of this, "<"+"/script>" is what I recommend, but that applies only to closing tags. That is, "<script>" (or "script" as the case may be) is perfectly valid inside a script block.

    Happy coding.


    *By a compliant HTML parser: however, hand-rolled (regex) parsing may explode in terrible ways. The XML/XHTML rules are different, but then the < needs to be encoded for those to be well-formed anyway … perhaps some obscurities with CDATA? In any case, it is irrelevant to HTML.

    Also, the linked answers do not argue for "<scr"+"ipt.." (or subsets like "scr"+"ipt"): instead, they argue for guarding against the closing script-tag construct, which begins with </, that is not even present in the code in the post…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given my previous questions about the the usage of AMPL. Are there any other
I know there are a load of other questions on this topic, I think
There are other questions about this in other languages , and other non-lazy JavaScript
Given the Below Tables. How do I get the Distinct name given the other
Given I have a master branch and a other branch. In the other branch
Given a folder structure: parentFolder - ChildFolder1 - somefiletolookfor.txt - (other files and folder)
Given an aggregation of class instances which refer to each other in a complex,
given a somewhat complex file of unknown specification that among other things contains an
In other words, given a base class shape and a derived class rectangle :
Given two planes positioned and rotated arbitrary to each other, I'm trying to determine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.