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

  • SEARCH
  • Home
  • 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 7884863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:54:52+00:00 2026-06-03T04:54:52+00:00

While going through the source for Remy Sharp’s demo of Simple Drag and Drop

  • 0

While going through the source for Remy Sharp’s demo of Simple Drag and Drop, I found this function:

function entities(s) {
  var e = {
    '"' : '"',
    '&' : '&',
    '<' : '<',
    '>' : '>'
  };
  return s.replace(/["&<>]/g, function (m) {
    return e[m];
  });
}

From what I see, it just replaces ” or & or < or > with itself. So there is no need for that function.

How am I wrong?

UPDATE:
Source can be viewed by clicking ‘View Source’ at the end of the page.

  • 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-06-03T04:54:53+00:00Added an answer on June 3, 2026 at 4:54 am

    I looked the source of the page in Chrome with Ctrl+U, and this is what I found:

    function entities(s) {
      var e = {
        '"' : '&quot;',
        '&' : '&amp;',
        '<' : '&lt;',
        '>' : '&gt;'
      };
      return s.replace(/["&<>]/g, function (m) {
        return e[m];
      });
    }
    

    This, obviously, does something — namely, it replaces special characters with an escaped form.

    The reason that you saw what you did is that the source you’re viewing on the “view source” page is being rendered in HTML. Thus, when the source’s &quot; string is rendered on the “view source” page, it shows up on the HTML page as ". HTML5Deoms really should escape the ampersands on their view-source pages like &amp;quot; so that it will show up on rendered source page correctly as &quot;, but they don’t do that.

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

Sidebar

Related Questions

Yesterday while going through this question, I found a curious case of passing and
While going through some tutorials, I have encountered lines such as this: ((IDisposable)foo).Dispose(); Ignore
While going through the syslog file, I found a message like shutdown via gdm
While going through the book Scala for the Impatient , I came across this
while going through some of the mili source code I came across a struct
While going through one of the library, I found the following construct in java
I can't figure out my mistake while going through this tutorial . The following
I found a lot of Optimization Options here While going through them I found
While going through the source, I noticed that 'toggle' supposedly uses jQuery._data to store
I'm getting this error while going through Spring in Action: 3rd edition: Chapter 1.

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.