You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should 'true' count as truthy in parsing windowFeatures booleans? #7399
If value is the empty string, then return true.
If value is "yes", then return true.
Let parsed be the result of parsing value as an integer.
If parsed is an error, then set it to 0.
Return false if parsed is 0, and true otherwise.
...which means that something like window.open('about:blank','','popup=true') interprets the popup=true to mean popup is false. Not very intuitive.
Should we add "true" as a value that results in true?
WebKit already allows "1" / "on" / "yes". I don't mind adding support for "true" too if other browser engines do the same.
"true" seems like a logical value for a boolean.
I don't really like the idea of popup=popup meaning true though.
Indeed, it looks like I was wrong, we allow "on" only for some features: center, resizable, status, scroll. For noopener, it seems we allow "yes" and any numeric value other than 0 (not sure why noopener is not treated like our other boolean features).
The one concern I have here is if we do want to switch to using a dictionary for "cool window features" (such as noopener, noreferrer, and popup) this seems a lot less worth it.
Great, so what's required now before landing #7425 is web platform tests.
Per the triage meeting, as a bonus, it'd be great if we also made sure the web platform tests were comprehensive for "on" / "off", "yes" / "no", and non-zero numeric values as well, since it sounds like there's probably some divergence from the spec there, and perhaps interop issues.
We can land the spec change when there's a CL in review with tests.
Thanks for the pointer. I thought about adding another set of cases there for =true but ended up just writing a fresh test that looks at just values for noopener, noreferrer, and popup. (The other boolean window features seem like overkill to test, and a bit nebulous given our recent changes to how popups work.)
One question did come out of my new test though. What do we think about these?
noreferrer=true// With the new PR, this will result in noreferrer being *true*noreferrer="true"// The quotes cause a parse error, and noreferrer is *false*noreferrer='true'// Same here, *false*
Currently, the rules, and browsers, treat quotation marks as a parse error and the quoted values are interpreted as false. But akin to the rationale for making property=trueenableproperty, I would think we'd similarly want to make property="true" work as well? Perhaps there's more context for why we don't allow quotes here, whereas we're pretty lenient on quotes most other places in the web platform?
I think they should continue to be false. If you start allowing quotation marks you make the features tokenizer more complicated, at least if you want it to make sense, e.g.:
I think they should continue to be false. If you start allowing quotation marks you make the features tokenizer more complicated, at least if you want it to make sense, e.g.:
noopener=", popup=1, "
Does this have popup=1 as a feature, or no?
Right - that's a great point. Ok, I agree with you, quotes should parse as false.
Ok, quick and dirty tests have been added here: web-platform-tests/wpt#33029
Comments appreciated. I will wait to land them until I've sent an intent to ship for Chromium, and the spec has landed.
Activity
annevk commentedon Dec 9, 2021
This hasn't been a problem for the other features thus far, e.g.,
noopener. @zcorpan probably knows the answer here.zcorpan commentedon Dec 9, 2021
See #2600 -- the spec matched what browsers did for the legacy booleans.
I don't mind supporting
true.Do people expect
popup=popupto also mean true?zcorpan commentedon Dec 9, 2021
cc @cdumez
cdumez commentedon Dec 9, 2021
WebKit already allows "1" / "on" / "yes". I don't mind adding support for "true" too if other browser engines do the same.
"true" seems like a logical value for a boolean.
I don't really like the idea of
popup=popupmeaning true though.zcorpan commentedon Dec 17, 2021
"on" wasn't specified in #4079 . Testing with http://software.hixie.ch/utilities/js/live-dom-viewer/saved/9908 webkit/chromium/gecko do not support it.
Make 'true' a truthy value for window.open boolean features
cdumez commentedon Dec 17, 2021
Indeed, it looks like I was wrong, we allow "on" only for some features: center, resizable, status, scroll. For noopener, it seems we allow "yes" and any numeric value other than 0 (not sure why noopener is not treated like our other boolean features).
annevk commentedon Dec 20, 2021
The one concern I have here is if we do want to switch to using a dictionary for "cool window features" (such as noopener, noreferrer, and popup) this seems a lot less worth it.
domenic commentedon Jan 11, 2022
Here is my proposal for "switching to a dictionary for cool window features": #7485
I don't really want to block small improvements everyone is on-board with in favor of larger changes though, so take it with a grain of salt...
zcorpan commentedon Feb 18, 2022
@mfreed7 @cdumez do you still think this is a worthwhile change, considering there's now a proposed modern API (#7485)?
cdumez commentedon Feb 18, 2022
This is a very small amount of work to treat 'true' as truthy so I don't mind doing it, even if there is modern API proposal.
mfreed7 commentedon Feb 21, 2022
+1 - I support this. The modern syntax is nice, but I think it can coexist with this small change to the old syntax.
domenic commentedon Feb 27, 2022
Great, so what's required now before landing #7425 is web platform tests.
Per the triage meeting, as a bonus, it'd be great if we also made sure the web platform tests were comprehensive for "on" / "off", "yes" / "no", and non-zero numeric values as well, since it sounds like there's probably some divergence from the spec there, and perhaps interop issues.
2 remaining items
mfreed7 commentedon Mar 1, 2022
Thanks for the pointer. I thought about adding another set of cases there for =true but ended up just writing a fresh test that looks at just values for noopener, noreferrer, and popup. (The other boolean window features seem like overkill to test, and a bit nebulous given our recent changes to how popups work.)
One question did come out of my new test though. What do we think about these?
Currently, the rules, and browsers, treat quotation marks as a parse error and the quoted values are interpreted as
false. But akin to the rationale for makingproperty=trueenableproperty, I would think we'd similarly want to makeproperty="true"work as well? Perhaps there's more context for why we don't allow quotes here, whereas we're pretty lenient on quotes most other places in the web platform?zcorpan commentedon Mar 1, 2022
I think they should continue to be
false. If you start allowing quotation marks you make the features tokenizer more complicated, at least if you want it to make sense, e.g.:Does this have
popup=1as a feature, or no?Add "true" to truthy values list for windowFeatures
mfreed7 commentedon Mar 2, 2022
Right - that's a great point. Ok, I agree with you, quotes should parse as false.
Ok, quick and dirty tests have been added here: web-platform-tests/wpt#33029
Comments appreciated. I will wait to land them until I've sent an intent to ship for Chromium, and the spec has landed.
Add "true" to truthy values list for windowFeatures
Add "true" to truthy values list for windowFeatures
Add "true" to truthy values list for windowFeatures
Add "true" to truthy values list for windowFeatures
Make 'true' a truthy value for window.open boolean features
Bug 1757777 [wpt PR 33029] - Add "true" to truthy values list for win…
Bug 1757777 [wpt PR 33029] - Add "true" to truthy values list for win…
Make 'true' a truthy value for window.open boolean features
Add "true" to truthy values list for windowFeatures
Bug 1757777 [wpt PR 33029] - Add "true" to truthy values list for win…