guardian / scribe

DEPRECATED: A rich text editor framework for the web platform

Home Page:http://guardian.github.io/scribe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logic bug in node.removeChromeArtifacts()

mindplay-dk opened this issue · comments

Possible logic bug here:

      if (!node.getAttribute('style')) {
        node.removeAttribute('style');
      }

I'm not sure what this was intended to do, but it appears to say, "if the node doesn't have the attribute, remove the attribute" - I'm not sure what the intent was, but I don't think this code does anything?

@regiskuckaertz do you remember what this code was trying to achieve?

@rrees Javascript and type coercion... the empty string is false in JS: this code was meant to eliminate instances of <elem style="">. At least that's what I think.

@regiskuckaertz ah, would it be clearer to have the comparison with the empty string here to avoid people deleting it as a no-op?

@rrees yes definitely, that's a code smell. I can raise a PR if you want?

@regiskuckaertz that'd be smashing