Closed
Bug 1209190
Opened 10 years ago
Closed 2 years ago
Assigning ternary operator to innerHTML isn't flagged
Categories
(addons.mozilla.org Graveyard :: Add-on Validation, defect)
addons.mozilla.org Graveyard
Add-on Validation
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: jwkbugzilla, Unassigned)
Details
I noticed that innerHTML in some minified code wasn't flagged by the validator. After some reducing, the validator apparently doesn't consider the following dynamic:
a.innerHTML=(true?x:x)+""
This might be the same as bug 1197206, impossible to tell without real info over there.
| Reporter | ||
Comment 1•10 years ago
|
||
Looking a bit into this, conditional expressions apparently aren't being processed at all, so that their value is considered to be None. While that isn't considered a literal by itself, the processing of the binary + operator will convert None into an empty string - so the result of adding a string to a ternary operator is always considered to be a string.
The same issue exists with the sequence expression, its value isn't being determined either - so the following won't trigger any warnings:
a.innerHTML=(y,x)+""
Also logical expression:
a.innerHTML=(true&&x)+""
And yield expression:
function* foo()
{
a.innerHTML=(yield getHTML())+""
}
And array comprehension:
a.innerHTML=[for (x of [foo, bar]) x]+""
While update expressions and generator comprehensions aren't handled either, these don't seem important in this context.
| Reporter | ||
Updated•10 years ago
|
Summary: Assigning ternary operator to innerHTML isn't be flagged → Assigning ternary operator to innerHTML isn't flagged
| Assignee | ||
Updated•10 years ago
|
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•