ID:2390669
 
Not a bug
BYOND Version:511
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Firefox 61.0
Applies to:Dream Daemon
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:

The HTML parsing which is performed on browse() output removes some whitespace which has an impact. Results shown in browse()d windows differs from what is rendered by IE itself.

Specifically the HTML is "A <span id='foo'></span> B", where the contents of 'foo' are filled in by JavaScript, and the space between those contents and B, which should be present, has been removed by BYOND.

Code Snippet (if applicable) to Reproduce Problem:
Here's a toy example which demonstrates what the HTML parser is doing:

/client/New()
..()
src << browse("A <span id='foo'></span> B <script>alert(document.body.innerHTML.replace(/ /g,'*'));</script>", "window=test")


Expected Results:

In IE11, my system IE:
A*<span*id="foo"></span>*B*<script>alert(document.body.innerHTML.replace(/*/g,'*'));</script>


Actual Results:

In BYOND:
A*<SPAN id=foo></SPAN>B<SCRIPT>alert(document.body.innerHTML.replace(/*/g,'*'));</SCRIPT>


Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes, in a test project.
In other user accounts? Unknown.
On other computers? Unknown.

When does the problem NOT occur?

When the stripped whitespace is not, in fact, significant.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Present in 511.1385 and 512.1445.

Workarounds:

Probably some JS hack is possible, or maybe nbsp fiddling, but I haven't got anything exact yet.
BYOND doesn't do any parsing of the kind you're talking about. It doesn't really interfere with the content of the page at all, except we used to do some stuff for IE6 to fix .png files and the like (we still have that code, but I'm gonna nuke it at some point because nobody has IE6 anymore).

This smelled of an IE issue, the kind you would see in older versions, so I did some testing. I confirmed your issue, but I also confirmed it's a bug in older IE as I thought. Specifically, it goes away if you add this to the beginning of your output:

<!DOCTYPE html><html><head><meta http-equiv='X-UA-Compatible' content='IE=edge'></head><body>
Lummox JR resolved issue (Not a bug)
I guess I was caught off-guard by a difference between IE in BYOND and IE standalone. That meta tag solves the problem indeed, but I may keep it in my pocket for later use given how much else it seems to affect. Thanks for the info either way.
Yeah, the thing is IE standalone will behave according to its own rules, whereas embedded it emulates older versions unless you tell it not to.

Login to reply.