Skip to content

Commit

Permalink
Rename the popup IDL attribute to popUp, per resolution
Browse files Browse the repository at this point in the history
See [1] for details, but `popup` as an IDL property is not web
compatible. The community has decided to try `popUp` to see if perhaps
that will be more compatible.

[1] openui/open-ui#546 (comment)

Bug: 1307772
Fixed: 1332480

Change-Id: I0b42c49a9c7b7fa7a6bf10c61443a8b52fb977bf
  • Loading branch information
Mason Freed authored and chromium-wpt-export-bot committed Jun 17, 2022
1 parent 9733094 commit 1407191
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
function addPopup(classname) {
const popup = document.createElement('div');
popup.popup = 'auto';
popup.popUp = 'auto';
popup.classList = classname;
popup.textContent = 'This is a popup';
document.body.appendChild(popup);
Expand Down
56 changes: 28 additions & 28 deletions html/semantics/popups/popup-attribute-basic.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,43 +79,43 @@
// Setting IDL to something sets the content attribute to exactly that, always.
// GETTING the IDL only gets valid values.
const popup = createPopup(t);
assert_equals(popup.popup,'auto');
assert_equals(popup.popUp,'auto');
popup.setAttribute('popup','hint');
assert_equals(popup.popup,'hint');
assert_equals(popup.popUp,'hint');
popup.setAttribute('popup','HiNt');
assert_equals(popup.popup,'hint','Case is normalized in IDL');
assert_equals(popup.popUp,'hint','Case is normalized in IDL');
assert_equals(popup.getAttribute('popup'),'HiNt','Case is *not* normalized/changed in the content attribute');
popup.popup='hInT';
assert_equals(popup.popup,'hint','Case is normalized in IDL');
popup.popUp='hInT';
assert_equals(popup.popUp,'hint','Case is normalized in IDL');
assert_equals(popup.getAttribute('popup'),'hInT','Value set from IDL is propagated exactly to the content attribute');
popup.setAttribute('popup','invalid');
assert_equals(popup.popup,null,'Invalid values should reflect as null');
assert_equals(popup.popUp,null,'Invalid values should reflect as null');
popup.removeAttribute('popup');
assert_equals(popup.popup,null,'No value should reflect as null');
popup.popup='hint';
assert_equals(popup.popUp,null,'No value should reflect as null');
popup.popUp='hint';
assert_equals(popup.getAttribute('popup'),'hint');
popup.popup='auto';
popup.popUp='auto';
assert_equals(popup.getAttribute('popup'),'auto');
popup.popup='';
popup.popUp='';
assert_equals(popup.getAttribute('popup'),'');
assert_equals(popup.popup,'auto');
popup.popup='AuTo';
assert_equals(popup.popUp,'auto');
popup.popUp='AuTo';
assert_equals(popup.getAttribute('popup'),'AuTo');
assert_equals(popup.popup,'auto');
popup.popup='invalid';
assert_equals(popup.popUp,'auto');
popup.popUp='invalid';
assert_equals(popup.getAttribute('popup'),'invalid','IDL setter allows any value');
assert_equals(popup.popup,null,'but IDL getter does not re-reflect invalid values');
popup.popup='';
assert_equals(popup.popUp,null,'but IDL getter does not re-reflect invalid values');
popup.popUp='';
assert_equals(popup.getAttribute('popup'),'','IDL setter propagates exactly');
assert_equals(popup.popup,'auto','Empty should map to auto in IDL');
popup.popup='auto';
popup.popup=null;
assert_equals(popup.popUp,'auto','Empty should map to auto in IDL');
popup.popUp='auto';
popup.popUp=null;
assert_equals(popup.getAttribute('popup'),null,'Setting null for the IDL property should remove the content attribute');
assert_equals(popup.popup,null,'Null returns null');
popup.popup='auto';
popup.popup=undefined;
assert_equals(popup.popUp,null,'Null returns null');
popup.popUp='auto';
popup.popUp=undefined;
assert_equals(popup.getAttribute('popup'),null,'Setting undefined for the IDL property should remove the content attribute');
assert_equals(popup.popup,null,'undefined returns null');
assert_equals(popup.popUp,null,'undefined returns null');
},'IDL attribute reflection');

test((t) => {
Expand All @@ -129,11 +129,11 @@
popup.setAttribute('PoPuP','AuTo');
assertIsFunctionalPopup(popup);
// Via IDL also
popup.popup = 'auto';
popup.popUp = 'auto';
assertIsFunctionalPopup(popup);
popup.popup = 'aUtO';
popup.popUp = 'aUtO';
assertIsFunctionalPopup(popup);
popup.popup = 'invalid';
popup.popUp = 'invalid';
assertNotAPopup(popup);
},'Popup attribute value should be case insensitive');

Expand All @@ -144,9 +144,9 @@
assertIsFunctionalPopup(popup);
popup.setAttribute('popup','invalid'); // Change popup type to something invalid
assertNotAPopup(popup);
popup.popup = 'hint'; // Change popup type via IDL
popup.popUp = 'hint'; // Change popup type via IDL
assertIsFunctionalPopup(popup);
popup.popup = 'invalid'; // Make invalid via IDL
popup.popUp = 'invalid'; // Make invalid via IDL
assertNotAPopup(popup);
},'Changing attribute values for popup should work');

Expand Down
6 changes: 3 additions & 3 deletions html/semantics/popups/popup-focus.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@
priorFocus.focus();
popup.showPopup();
assert_equals(document.activeElement, expectedFocusedElement, `${testName} activated by popup.showPopup()`);
assert_equals(popup.popup, 'auto', 'All popups in this test should start as popup=auto');
popup.popup = 'hint';
assert_equals(popup.popUp, 'auto', 'All popups in this test should start as popup=auto');
popup.popUp = 'hint';
assert_false(popup.matches(':top-layer'), 'Changing the popup type should hide the popup');
assert_equals(document.activeElement, priorFocus, 'prior element should get focus when the type is changed');
popup.popup = 'auto';
popup.popUp = 'auto';

// Remove from the document:
priorFocus.focus();
Expand Down
8 changes: 4 additions & 4 deletions html/semantics/popups/popup-invoking-attribute.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@
s_set.forEach(s => {
h_set.forEach(h => {
promise_test(async test => {
const popup1 = Object.assign(document.createElement('div'),{popup: type, id: 'popup-1'});
const popup2 = Object.assign(document.createElement('div'),{popup: type, id: 'popup-2'});
assert_equals(popup1.popup,type);
assert_equals(popup2.popup,type);
const popup1 = Object.assign(document.createElement('div'),{popUp: type, id: 'popup-1'});
const popup2 = Object.assign(document.createElement('div'),{popUp: type, id: 'popup-2'});
assert_equals(popup1.popUp,type);
assert_equals(popup2.popUp,type);
assert_not_equals(popup1.id,popup2.id);
const invoker = testcase.makeElement(test);
if (t) invoker.setAttribute('togglepopup',t===1 ? popup1.id : popup2.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@
<body>
<script>
const types = Object.freeze({
popup: Symbol("Popup API"),
popUp: Symbol("Popup API"),
modalDialog: Symbol("Modal Dialog"),
fullscreen: Symbol("Fullscreen Element"),
});
const examples = [
{
type: types.popup,
closes: [types.popup],
createElement: () => Object.assign(document.createElement('div'), {popup: 'auto'}),
type: types.popUp,
closes: [types.popUp],
createElement: () => Object.assign(document.createElement('div'), {popUp: 'auto'}),
trigger: function() {this.element.showPopup()},
close: function() {this.element.hidePopup()},
isTopLayer: function() {return this.element.matches(':top-layer')},
},
{
type: types.modalDialog,
closes: [types.popup],
closes: [types.popUp],
createElement: () => document.createElement('dialog'),
trigger: function() {this.element.showModal();this.showing=true;},
close: function() {this.element.close();this.showing=false;},
isTopLayer: function() {return !!(this.element.isConnected && this.showing);},
},
{
type: types.fullscreen,
closes: [types.popup, types.fullscreen],
closes: [types.popUp, types.fullscreen],
createElement: () => document.createElement('div'),
trigger: async function(visibleElement) {assert_false(this.isTopLayer());await bless(visibleElement);await this.element.requestFullscreen();},
close: function() {assert_equals(this.element,document.fullscreenElement); document.exitFullscreen();},
Expand Down

0 comments on commit 1407191

Please sign in to comment.