Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /soft-navigation-heuristics/detection/tentative/change-style-attribute-display-1.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/soft-navigation-heuristics/resources/soft-navigation-test-helper.js"></script>
<div id="visibleDiv">Visible Text</div>
<div id="hiddenDiv" style="display:none">Hidden Text</div>
<div><button id="navigateButton">Navigate!</button></div>
<script>
promise_test(t => {
const url = '/toggleHidden';
const modifyDOM = () => {
visibleDiv.setAttribute('style', 'display:none');
hiddenDiv.setAttribute('style', '');
return hiddenDiv.id;
};
const helper = new SoftNavigationTestHelper(t);
return helper.clickAndExpectSoftNavigation(navigateButton, url, modifyDOM);
}, 'Soft Navigation Detection supports changing inline style display via setAttribute');
</script>