From 81c28995d0c6bbd80e3ac4d03b5e7b5d855372ca Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 23 May 2018 16:53:11 +0200 Subject: [PATCH] Test query encoding of attributes separately This also changes how we test the ping IDL attribute as the HTML Standard does not require it to be reflected other than as a string. It also adds testing for . Helps with #4934. --- .../query-encoding/attributes.sub.html | 66 +++++++++++++++++++ .../query-encoding/resources/resolve-url.js | 49 -------------- 2 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html diff --git a/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html b/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html new file mode 100644 index 00000000000000..c6521f0a886077 --- /dev/null +++ b/html/infrastructure/urls/resolving-urls/query-encoding/attributes.sub.html @@ -0,0 +1,66 @@ + + + + + + + + + +
+ diff --git a/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js b/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js index 9e0f7f53135ac0..2c8a7fe7b96e2a 100644 --- a/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js +++ b/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js @@ -49,55 +49,6 @@ onload = function() { test_obj.step_timeout(poll, 200); } - // background attribute, check with getComputedStyle - function test_background(tag) { - var spec_url = 'https://html.spec.whatwg.org/multipage/rendering.html'; - spec_url += tag == 'body' ? '#the-page' : '#tables'; - test(function() { - var elm = document.createElement(tag); - document.body.appendChild(elm); - this.add_cleanup(function() { - document.body.removeChild(elm); - }); - elm.setAttribute('background', input_url_png); - var got = getComputedStyle(elm).backgroundImage; - assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got)); - }, 'getComputedStyle <'+tag+' background>', - {help:spec_url}); - } - - 'body, table, thead, tbody, tfoot, tr, td, th'.split(', ').forEach(function(str) { - test_background(str); - }); - - // get a reflecting IDL attributes whose content attribute takes a URL or a list of space-separated URLs - function test_reflecting(tag, attr, idlAttr, multiple) { - idlAttr = idlAttr || attr; - var input = input_url_html; - if (multiple) { - input += ' ' + input; - } - test(function() { - var elm = document.createElement(tag); - assert_true(idlAttr in elm, idlAttr + ' is not supported'); - elm.setAttribute(attr, input); - var got = elm[idlAttr]; - assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got)); - }, 'Getting <'+tag+'>.'+idlAttr + (multiple ? ' (multiple URLs)' : ''), - {help:'https://html.spec.whatwg.org/multipage/#reflecting-content-attributes-in-idl-attributes'}); - } - - ('iframe src, a href, base href, link href, img src, embed src, object data, track src, video src, audio src, input src, form action, ' + - 'input formaction formAction, button formaction formAction, script src').split(', ').forEach(function(str) { - var arr = str.split(' '); - test_reflecting(arr[0], arr[1], arr[2]); - }); - - 'a ping'.split(', ').forEach(function(str) { - var arr = str.split(' '); - test_reflecting(arr[0], arr[1], arr[2], true); - }); - function setup_navigation(elm, iframe, id, test_obj) { iframe.name = id; elm.target = id;