ID:1926248
 
BYOND Version:508
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 44.0.2403.157
Applies to:Webclient
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary: Text outputted to a control is modified to contain various html tags that are not wanted.

Numbered Steps to Reproduce Problem: Simply output some text to a control and check if it was modified. I've been able to reproduce this consistently, on multiple versions. My specific .dms file can be seen below.

Code Snippet (if applicable) to Reproduce Problem:
<byondclass name = "custom_popup">

<style>
.byond_custom_popup:hover {
opacity: 1;
-webkit-transition: opacity 0.5s ease-in;
-moz-transition: opacity 0.5s ease-in;
-o-transition: opacity 0.5s ease-in;
-ms-transition: opacity 0.5s ease-in;
transition: opacity 0.5s ease-in;
}

.byond_custom_popup {
width: 200px;
height: 150px;
opacity: 0.5;

position: absolute;
top: calc(50% - 200px / 2);
left: calc(50% - 150px / 2);

background: #ccc;
color: #fff;
font-family: 'Roboto';
font-size: 12px;
text-align: center;
text-shadow: 1px 1px 0 #000, 2px 2px 0 #000;
border: 1px solid #000;
}
</style>

<script>
{
fn: {
output: function(obj) {
if(obj.text) this.topic("action=output;text=" + obj.text);
}
}
}
</script>

<div id = "main_content"></div>

</byondclass>


Expected Results: Receiving the text as it was sent.

Actual Results: Receiving the text with the html entities span and line break. Example result: [received text]


Does the problem occur:
Every time? Or how often? Every time.

When does the problem NOT occur? It doesn't.

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.) I tested in 508.1292 and it still occurred.

Workarounds: None that I've come across so far.
Update: I just did a test in another (blank) environment using this:
<byondclass name="testclass">

<style>
</style>

<script>
{
fn: {
output: function(obj) {
if(obj.text) console.log(obj.text);//this.topic("action=output;text=" + obj.text);
}
}
}
</script>

<div id="content" class="content"></div>

</byondclass>


The output came back only with a line break at the end, no span tags. However, in my main project using the snippet in the initial post, I get the text back as described initially, even when I remove the color property from the CSS (which is what I thought the cause was).

Edit: I disabled my main project's .dmf skin and the span tags no longer appear, though the line break still does.
The line break is expected and not a bug. (To skip it, you'd need the \... macro at the end of the output text.) The empty span, however, is.
In response to Lummox JR
I went through my .dmf skin and tested each control. The problem seems to have to do with having an output. Once I remove my .dmf skin's output, the webclient sends the text back as expected. However, with an output in the .dmf skin, you get the span tags for whatever reason. (Edit: Going to test this in a fresh environment.)

Edit: Bleh... it's not being consistent now. I'll report back as soon as I figure this out.
If you have a test case that includes the span, please let me know. I'd definitely like to make sure the tag is not output when it isn't needed.
In response to Lummox JR
Paged you.
Your test project isn't showing me incorrect behavior as currently defined. The span tag in the situation you outlined is not empty; it has a style, setting a foreground color for the text, and that style does appear to be correct based on the expected behavior. (output.style is not directly supported in the webclient.)
In response to Lummox JR
That span tag shouldn't be there though since there is no styling to be done to the text. I'm sending a plain text message and getting text with span tags back.

About to record exactly what I'm talking about.
This is me running the project I sent you as-is:

Notice there's no span tags on those two messages.

Here's another run after copying the chat_pane from the other .dmf skin:
Styling is being done to the text, because of the output.style parameter.
In response to Lummox JR
Can you explain to me what this output.style parameter is? You aren't talking about the output control in the .dmf skin, are you?
Yes. Your output has a style set in the skin editor.
In response to Lummox JR
I thought so. That didn't make any difference at all in my earlier tests once it was cleared though. I'll try it again now.

Edit: Yeah, the output having a style makes no difference whatsoever.