<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">This sounds like a great idea because I actually don't think I knew about this. It seems like a difference from HTML that could easily introduce bugs and therefore would be nice to remove.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 6, 2019 at 1:33 PM Brian Grinstead <<a href="mailto:bgrinstead@mozilla.com">bgrinstead@mozilla.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Right now if you do `xulEl.getAttribute(“foo")` and the attribute is missing it will return `""`. With `htmlEl.getAttribute(“foo")` it will return null. I’d like to make the xul element behavior consistent with HTMLElement.<br>
<br>
There's frontend code / tests that rely on the current behavior, so rather than having to deal with this one by one as we migrate XUL elements to HTML I think we should have an up-front change where we change those callers and update the behavior.<br>
<br>
It seems tricky to find every caller that would have it's behavior change from this, but the things I expect to come up are test assertions, and stuff like:<br>
<br>
```<br>
// String concatenation<br>
xulEl.getAttribute("foo") + "string” // “string”<br>
htmlEl.getAttribute("foo") + "string" // "nullstring"<br>
<br>
// Expecting it to always return a string which will throw once it’s null:<br>
docTitle = tab.getAttribute("label").replace(/\0/g, "”);<br>
```<br>
<br>
I’m hoping our tests will catch most issues like this.<br>
<br>
Thanks,<br>
Brian<br>
<br>
_______________________________________________<br>
firefox-dev mailing list<br>
<a href="mailto:firefox-dev@mozilla.org" target="_blank">firefox-dev@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/firefox-dev</a><br>
</blockquote></div>