64

If the code block contains HTML entities then those are parsed and displayed instead of displaying the plain value.

The below code block contains � as the input value, but instead of displaying it as such, the parsed text is displayed like �.

< !-- begin snippet: js hide: false -->
<!-- language: lang-js -->

    $('body').html($('<input />', {
        id: "myInput",
        type: "text",
        value: "&#0;"
    }));

<!-- end snippet -->

becomes:

$('body').html($('<input />', {
    id: "myInput",
    type: "text",
    value: "&#0;"
}));

Outside snippet display (and in edit preview) it seems to be fine:

$('body').html($('<input />', {
    id: "myInput",
    type: "text",
    value: "&#0;"
}));

Source: Appending a new input textbox DOM to HTML body using jQuery

5
  • 1
    How about comments? &#0; Sep 22, 2014 at 16:36
  • 19
    That is caused by the fact that it is a stack-snippet. Without the stack-snippet the entity is showen correctly. A bug indeed. Do notice that if you hit edit, the preview does show the html entity correctly.
    – rene
    Sep 22, 2014 at 16:54
  • 19
    Also note that 'Copy snippet to answer' results in a snippet that with � in the source code rather than &#0.
    – p.s.w.g
    Sep 22, 2014 at 17:49
  • 5
    This is a real bug. Absolutely.
    – tbodt
    Sep 22, 2014 at 23:35
  • I've reproduced this locally and am working on a fix now.
    – Haney
    Sep 23, 2014 at 21:28

1 Answer 1

3

Thank you for reporting this bug. I've fixed the issue and HTML entities will display and evaluate properly in the next production build. (meta: > rev 2014.9.23.2598, q&a: > rev 2014.9.23.1885).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .