From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../tests/scroll-to-text-fragment/META.yml | 4 + .../scroll-to-text-fragment/client-redirect.html | 12 + .../find-range-from-text-directive-target.html | 78 ++++++ .../find-range-from-text-directive.html | 305 +++++++++++++++++++++ .../force-load-at-top-target.html | 15 + .../force-load-at-top-target.html.headers | 1 + .../scroll-to-text-fragment/force-load-at-top.html | 60 ++++ .../scroll-to-text-fragment/force-load-at-top.js | 33 +++ .../scroll-to-text-fragment/idlharness.window.js | 15 + .../scroll-to-text-fragment/iframe-scroll.sub.html | 65 +++++ .../scroll-to-text-fragment/iframe-target.html | 50 ++++ .../tests/scroll-to-text-fragment/iframes.sub.html | 112 ++++++++ .../scroll-to-text-fragment/navigate-back.html | 8 + .../no-force-load-at-top-target.html | 16 ++ .../no-force-load-at-top-target.html.headers | 1 + .../non-html-documents.html | 49 ++++ .../scroll-to-text-fragment/redirects-target.html | 42 +++ .../scroll-to-text-fragment/redirects-target2.html | 28 ++ .../tests/scroll-to-text-fragment/redirects.html | 126 +++++++++ .../scroll-to-text-fragment/resources/non-html.css | 132 +++++++++ .../scroll-to-text-fragment/resources/non-html.js | 31 +++ .../resources/non-html.json | 102 +++++++ .../scroll-to-text-fragment/resources/non-html.txt | 25 ++ .../scroll-to-text-fragment/resources/non-html.xml | 75 +++++ .../resources/self-text-directive-iframe.html | 21 ++ .../same-document-tests.html | 80 ++++++ .../scroll-to-text-fragment-api.html | 32 +++ .../scroll-to-text-fragment-same-doc.html | 66 +++++ .../scroll-to-text-fragment-security.sub.html | 80 ++++++ .../scroll-to-text-fragment-target.html | 99 +++++++ .../scroll-to-text-fragment.html | 252 +++++++++++++++++ .../tests/scroll-to-text-fragment/stash.js | 29 ++ .../tests/scroll-to-text-fragment/stash.py | 13 + 33 files changed, 2057 insertions(+) create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/META.yml create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/client-redirect.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html.headers create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.js create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/idlharness.window.js create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/iframe-scroll.sub.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/iframe-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/iframes.sub.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/navigate-back.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html.headers create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/non-html-documents.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/redirects-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/redirects-target2.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/redirects.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.css create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.json create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.txt create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.xml create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/resources/self-text-directive-iframe.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/same-document-tests.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-api.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/stash.js create mode 100644 testing/web-platform/tests/scroll-to-text-fragment/stash.py (limited to 'testing/web-platform/tests/scroll-to-text-fragment') diff --git a/testing/web-platform/tests/scroll-to-text-fragment/META.yml b/testing/web-platform/tests/scroll-to-text-fragment/META.yml new file mode 100644 index 0000000000..118ab130db --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/META.yml @@ -0,0 +1,4 @@ +spec: https://wicg.github.io/scroll-to-text-fragment/ +suggested_reviewers: + - nburris + - bokan diff --git a/testing/web-platform/tests/scroll-to-text-fragment/client-redirect.html b/testing/web-platform/tests/scroll-to-text-fragment/client-redirect.html new file mode 100644 index 0000000000..73858969e0 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/client-redirect.html @@ -0,0 +1,12 @@ + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html new file mode 100644 index 0000000000..dc02ebd874 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive-target.html @@ -0,0 +1,78 @@ + +Tests find-a-range-from-a-text-directive algorithm + + + + + Won't scroll if matched: + match suffix + match suffix3 +
+

+ The quick brown fox jumped over the lazy dog. + a a b b b c +

+

+ foo foo foo bar bar bar +

+

+ match suffix2 + prefix match suffix3 matchEnd suffix4 matchEnd suffix5 +

+

+ Lorem + +
+

 
+ +
This isn't rendered
+
This also isn't visible
+ + + +     Ipsum + + Whitespace + +
+
 
+ +
This isn't rendered
+
This also isn't visible
+ + +     + + Dipsum + + + +

+

+ This text appears at the end of the document +

diff --git a/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive.html b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive.html new file mode 100644 index 0000000000..229f082747 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/find-range-from-text-directive.html @@ -0,0 +1,305 @@ + +Tests find-a-range-from-a-text-directive algorithm + + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html new file mode 100644 index 0000000000..72feec8a40 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html @@ -0,0 +1,15 @@ + +Navigating to a text fragment anchor + + + + + +

Top of page

+

target

+

history

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html.headers b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html.headers new file mode 100644 index 0000000000..33dcdbb01f --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top-target.html.headers @@ -0,0 +1 @@ +Document-Policy: force-load-at-top diff --git a/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.html b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.html new file mode 100644 index 0000000000..1399de3d62 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.html @@ -0,0 +1,60 @@ + +ForceLoadAtTop blocks scroll on load + + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.js b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.js new file mode 100644 index 0000000000..691168859f --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/force-load-at-top.js @@ -0,0 +1,33 @@ +function checkScroll() { + // Ensure two animation frames on load to test the fallback to element + // anchor, which gets queued for the next frame if the text fragment is not + // found. + requestAnimationFrame(() => { + requestAnimationFrame(() => { + let results = { + scrolled: (window.pageYOffset != 0), + }; + + let key = (new URL(document.location)).searchParams.get("key"); + stashResultsThenClose(key, results); + }); + }); +} + +window.addEventListener('pageshow', () => { + if (location.hash == "#history") { + // This is the "history" test - on the first load we'll navigate to a page + // that calls history.back(). When we load a second time (from the back + // navigation), record the scroll state at that point to check how history + // scroll restoration is handled. + if (history.state == null) { + history.pushState("test", "test", ""); + requestAnimationFrame(() => { + location.href = "navigate-back.html"; + }); + return; + } + } + + checkScroll(); +}); diff --git a/testing/web-platform/tests/scroll-to-text-fragment/idlharness.window.js b/testing/web-platform/tests/scroll-to-text-fragment/idlharness.window.js new file mode 100644 index 0000000000..c39216b581 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/idlharness.window.js @@ -0,0 +1,15 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +idl_test( + ['scroll-to-text-fragment'], + ['dom', 'html'], + idl_array => { + idl_array.add_objects({ + Document: ['document'], + FragmentDirective: ['document.fragmentDirective'], + }); + } +); diff --git a/testing/web-platform/tests/scroll-to-text-fragment/iframe-scroll.sub.html b/testing/web-platform/tests/scroll-to-text-fragment/iframe-scroll.sub.html new file mode 100644 index 0000000000..db959ab68d --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/iframe-scroll.sub.html @@ -0,0 +1,65 @@ + +Text directive in cross-origin iframe doesn't cause scrolling in main document + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/iframe-target.html b/testing/web-platform/tests/scroll-to-text-fragment/iframe-target.html new file mode 100644 index 0000000000..e1a6c85f1c --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/iframe-target.html @@ -0,0 +1,50 @@ + +Inner document for use in iframes.sub.html test + + + +

Target Text

+
DIV
+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/iframes.sub.html b/testing/web-platform/tests/scroll-to-text-fragment/iframes.sub.html new file mode 100644 index 0000000000..6b3e83f633 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/iframes.sub.html @@ -0,0 +1,112 @@ + +Navigating to text fragment directives in iframes + + + + + + + +
+ Same-Origin with text fragment in src attribute: + +
+
+ Same-Origin: + +
+
+ Cross-Origin: + +
+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/navigate-back.html b/testing/web-platform/tests/scroll-to-text-fragment/navigate-back.html new file mode 100644 index 0000000000..4b4117fcc5 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/navigate-back.html @@ -0,0 +1,8 @@ + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html b/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html new file mode 100644 index 0000000000..d2641eca72 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html @@ -0,0 +1,16 @@ + +Navigating to a text fragment anchor + + + + + +

Top of page

+

target

+

history

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html.headers b/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html.headers new file mode 100644 index 0000000000..e500009f91 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/no-force-load-at-top-target.html.headers @@ -0,0 +1 @@ +Document-Policy: force-load-at-top=?0 diff --git a/testing/web-platform/tests/scroll-to-text-fragment/non-html-documents.html b/testing/web-platform/tests/scroll-to-text-fragment/non-html-documents.html new file mode 100644 index 0000000000..d86cf482dd --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/non-html-documents.html @@ -0,0 +1,49 @@ + +Allow text fragments in HTML documents only + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/redirects-target.html b/testing/web-platform/tests/scroll-to-text-fragment/redirects-target.html new file mode 100644 index 0000000000..5e44230a95 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/redirects-target.html @@ -0,0 +1,42 @@ + +Destination of a Redirect + + + + +

Top of page

+

target

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/redirects-target2.html b/testing/web-platform/tests/scroll-to-text-fragment/redirects-target2.html new file mode 100644 index 0000000000..239c0fe1e6 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/redirects-target2.html @@ -0,0 +1,28 @@ + +Destination of a Redirect + + + + +

Top of page

+

target

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/redirects.html b/testing/web-platform/tests/scroll-to-text-fragment/redirects.html new file mode 100644 index 0000000000..5ad910affe --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/redirects.html @@ -0,0 +1,126 @@ + +TextFragment invoked on redirects + + + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.css b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.css new file mode 100644 index 0000000000..07f029442a --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.css @@ -0,0 +1,132 @@ + + :root { + font-family: system-ui; + } + .valueFlex { + width: 100%; + box-sizing: border-box; + height: 40px; + border: 1px solid grey; + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; + background-color: lightgrey; + + } + .valueFlex div { + height: 100%; + flex-grow: 1; + } + .valueFlex .value { + flex-grow: 4; + text-align: center; + } + + .valueFlex div div { + display: flex; + align-items: center; + justify-content: center; + } + + .valueFlex .value.disabled { + background-color: tomato; + } + .valueFlex .value.disabled div:before { + content: "Disabled"; + } + + .valueFlex .value.enabled { + background-color: chartreuse; + } + .valueFlex .value.enabled div:before { + content: "Enabled"; + } + + .valueGrid { + border: 1px solid grey; + display: grid; + grid-template-columns: 1fr 3fr; + } + + .valueGrid>div { + padding: 5px; + background-color: lightgrey; + display: flex; + justify-content: center; + align-items: center; + } + + .valueGrid>div>div { + overflow-wrap: anywhere; + } + + .valueGrid div.value { + background-color: thistle; + } + + .generator { + width: 100%; + box-sizing: border-box; + height: 40px; + border: 1px solid grey; + display: flex; + flex-direction: row; + align-items: center; + gap: 10px; + background-color: lightgrey; + } + + .items { + display: grid; + grid-template-columns: 1fr 4fr; + gap: 4px; + } + + .box { + border: 1px solid black; + } + + .box.label { + display: flex; + justify-content: center; + align-items: center; + } + + .box.listing { + padding: 10px; + display: grid; + grid-template-columns: 1fr 4fr; + row-gap: 2px; + } + + .box.listing div { + background-color: lightgrey; + } + .box.listing .value { + font-style: italic; + overflow-wrap: anywhere; + } + + .content { + } + + hr { + margin-top: 40px; + margin-bottom: 40px; + } + + #iframesContainer { + display:flex; + width: 100%; + border: 1px solid blue; + } + + #iframesContainer div { + flex: 1; + } + + #target { + width: 100px; + } + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js new file mode 100644 index 0000000000..b75d40dcde --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.js @@ -0,0 +1,31 @@ +// Taken from https://en.wikipedia.org/wiki/JavaScript + +// Declares a function-scoped variable named `x`, and implicitly assigns the +// special value `undefined` to it. Variables without value are automatically +// set to undefined. +var x; + +// Variables can be manually set to `undefined` like so +var x2 = undefined; + +// Declares a block-scoped variable named `y`, and implicitly sets it to +// `undefined`. The `let` keyword was introduced in ECMAScript 2015. +let y; + +// Declares a block-scoped, un-reassignable variable named `z`, and sets it to +// a string literal. The `const` keyword was also introduced in ECMAScript 2015, +// and must be explicitly assigned to. + +// The keyword `const` means constant, hence the variable cannot be reassigned +// as the value is `constant`. +const z = "this value cannot be reassigned!"; + +// Declares a variable named `myNumber`, and assigns a number literal (the value +// `2`) to it. +let myNumber = 2; + +// Reassigns `myNumber`, setting it to a string literal (the value `"foo"`). +// JavaScript is a dynamically-typed language, so this is legal. +myNumber = "foo"; + +const target = "foo"; diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.json b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.json new file mode 100644 index 0000000000..46fedf80eb --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.json @@ -0,0 +1,102 @@ +{ + "from":"https://json.org/example.html", + "web-app":{ + "servlet":[ + { + "servlet-name":"cofaxCDS", + "servlet-class":"org.cofax.cds.CDSServlet", + "init-param":{ + "configGlossary:installationAt":"Philadelphia, PA", + "configGlossary:adminEmail":"ksm@pobox.com", + "configGlossary:poweredBy":"Cofax", + "configGlossary:poweredByIcon":"/images/cofax.gif", + "configGlossary:staticPath":"/content/static", + "templateProcessorClass":"org.cofax.WysiwygTemplate", + "templateLoaderClass":"org.cofax.FilesTemplateLoader", + "templatePath":"templates", + "templateOverridePath":"", + "defaultListTemplate":"listTemplate.htm", + "defaultFileTemplate":"articleTemplate.htm", + "useJSP":false, + "jspListTemplate":"listTemplate.jsp", + "jspFileTemplate":"articleTemplate.jsp", + "cachePackageTagsTrack":200, + "cachePackageTagsStore":200, + "cachePackageTagsRefresh":60, + "cacheTemplatesTrack":100, + "cacheTemplatesStore":50, + "cacheTemplatesRefresh":15, + "cachePagesTrack":200, + "cachePagesStore":100, + "cachePagesRefresh":10, + "cachePagesDirtyRead":10, + "searchEngineListTemplate":"forSearchEnginesList.htm", + "searchEngineFileTemplate":"forSearchEngines.htm", + "searchEngineRobotsDb":"WEB-INF/robots.db", + "useDataStore":true, + "dataStoreClass":"org.cofax.SqlDataStore", + "redirectionClass":"org.cofax.SqlRedirection", + "dataStoreName":"cofax", + "dataStoreDriver":"com.microsoft.jdbc.sqlserver.SQLServerDriver", + "dataStoreUrl":"jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", + "dataStoreUser":"sa", + "dataStorePassword":"dataStoreTestQuery", + "dataStoreTestQuery":"SET NOCOUNT ON;select test='test';", + "dataStoreLogFile":"/usr/local/tomcat/logs/datastore.log", + "dataStoreInitConns":10, + "dataStoreMaxConns":100, + "dataStoreConnUsageLimit":100, + "dataStoreLogLevel":"debug", + "maxUrlLength":500 + } + }, + { + "servlet-name":"cofaxEmail", + "servlet-class":"org.cofax.cds.EmailServlet", + "init-param":{ + "mailHost":"mail1", + "mailHostOverride":"mail2" + } + }, + { + "servlet-name":"cofaxAdmin", + "servlet-class":"org.cofax.cds.AdminServlet" + }, + { + "servlet-name":"fileServlet", + "servlet-class":"org.cofax.cds.FileServlet" + }, + { + "servlet-name":"cofaxTools", + "servlet-class":"org.cofax.cms.CofaxToolsServlet", + "init-param":{ + "templatePath":"toolstemplates/", + "log":1, + "logLocation":"/usr/local/tomcat/logs/CofaxTools.log", + "logMaxSize":"", + "dataLog":1, + "dataLogLocation":"/usr/local/tomcat/logs/dataLog.log", + "dataLogMaxSize":"", + "removePageCache":"/content/admin/remove?cache=pages&id=", + "removeTemplateCache":"/content/admin/remove?cache=templates&id=", + "fileTransferFolder":"/usr/local/tomcat/webapps/content/fileTransferFolder", + "lookInContext":1, + "adminGroupID":4, + "betaServer":true + } + } + ], + "servlet-mapping":{ + "cofaxCDS":"/", + "cofaxEmail":"/cofaxutil/aemail/*", + "cofaxAdmin":"/admin/*", + "fileServlet":"/static/*", + "cofaxTools":"/tools/*" + }, + "taglib":{ + "taglib-uri":"cofax.tld", + "taglib-location":"/WEB-INF/tlds/cofax.tld", + "target": "foo" + } + } +} diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.txt b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.txt new file mode 100644 index 0000000000..785a4d56d6 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.txt @@ -0,0 +1,25 @@ +For its first five years (1990-1995), HTML went through a number of revisions and experienced a number of extensions, primarily hosted first at CERN, and then at the IETF. + +With the creation of the W3C, HTML's development changed venue again. A first abortive attempt at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year. + +The following year, the W3C membership decided to stop evolving HTML and instead begin work on an XML-based equivalent, called XHTML. This effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new features except the new serialization, and which was completed in 2000. After XHTML 1.0, the W3C's focus turned to making it easier for other working groups to extend XHTML, under the banner of XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not compatible with the earlier HTML and XHTML languages, calling it XHTML2. + +Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered out, with some DOM Level 3 specifications published in 2004 but the working group being closed before all the Level 3 drafts were completed. + +In 2003, the publication of XForms, a technology which was positioned as the next generation of web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements for it. This interest was borne from the realization that XML's deployment as a web technology was limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for existing deployed technologies (like HTML). + +A proof of concept to show that it was possible to extend HTML4's forms to provide many of the features that XForms 1.0 introduced, without requiring browsers to implement rendering engines that were incompatible with existing HTML web pages, was the first result of this renewed interest. At this early stage, while the draft was already publicly available, and input was already being solicited from all sources, the specification was only under Opera Software's copyright. + +The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where some of the principles that underlie the HTML5 work (described below), as well as the aforementioned early draft proposal covering just forms-related features, were presented to the W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal conflicted with the previously chosen direction for the web's evolution; the W3C staff and membership voted to continue developing XML-based replacements instead. + +Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to be jointly owned by all three vendors, and to allow reuse of the specification. + +The WHATWG was based on several core principles, in particular that technologies need to be backwards compatible, that specifications and implementations need to match even if this means changing the specification rather than the implementations, and that specifications need to be detailed enough that implementations can achieve complete interoperability without reverse-engineering each other. + +The latter requirement in particular required that the scope of the HTML5 specification include what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It also meant including significantly more detail than had previously been considered the norm. + +In 2006, the W3C indicated an interest to participate in the development of HTML5 after all, and in 2007 formed a working group chartered to work with the WHATWG on the development of the HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under the W3C copyright, while keeping a version with the less restrictive license on the WHATWG site. + +For a number of years, both groups then worked together. In 2011, however, the groups came to the conclusion that they had different goals: the W3C wanted to publish a "finished" version of "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously maintaining the specification rather than freezing it in a state with known problems, and adding new features as needed to evolve the platform. + +In 2019, the WHATWG and W3C signed an agreement to collaborate on a single version of HTML going forward: this document. diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.xml b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.xml new file mode 100644 index 0000000000..e938de2a82 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/non-html.xml @@ -0,0 +1,75 @@ + + + + Hello World + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + The quick brown dog jumped over the lazy fox + + + Target + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/resources/self-text-directive-iframe.html b/testing/web-platform/tests/scroll-to-text-fragment/resources/self-text-directive-iframe.html new file mode 100644 index 0000000000..43573692ea --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/resources/self-text-directive-iframe.html @@ -0,0 +1,21 @@ + + + + + + +

+ Target +

diff --git a/testing/web-platform/tests/scroll-to-text-fragment/same-document-tests.html b/testing/web-platform/tests/scroll-to-text-fragment/same-document-tests.html new file mode 100644 index 0000000000..be9bed9fd8 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/same-document-tests.html @@ -0,0 +1,80 @@ + +Same document navigation to text fragment directives + + + + + + + +
+ This is a line of text. +
+
+ This div has an id: 'elementid'. +
+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-api.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-api.html new file mode 100644 index 0000000000..d644b6b64f --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-api.html @@ -0,0 +1,32 @@ + +Fragment directive API + + + + + + + + + +

This is a test page

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html new file mode 100644 index 0000000000..378e373575 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html @@ -0,0 +1,66 @@ + +Navigating to a same-document text fragment directive + + + + + + + + + +

This is a test page

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html new file mode 100644 index 0000000000..5bcafed5dd --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-security.sub.html @@ -0,0 +1,80 @@ + +Navigating to a text fragment directive + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html new file mode 100644 index 0000000000..b2be85132c --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-target.html @@ -0,0 +1,99 @@ + +Navigating to a text fragment anchor + + + + +
Element
+

+ This is a test page !$'()*+./:;=?@_~ &,- ネコ +
+ foo foo foo bar bar bar +

+

More test page text

+
+
+

prefix

+

test page

+
+

suffix

+
+

this,is,test,page

+
+ +

hidden text

+

horizontally scrolled text

+

display none

+ diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html new file mode 100644 index 0000000000..73931d4b0e --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment.html @@ -0,0 +1,252 @@ + +Navigating to a text fragment directive + + + + + + + + + + + diff --git a/testing/web-platform/tests/scroll-to-text-fragment/stash.js b/testing/web-platform/tests/scroll-to-text-fragment/stash.js new file mode 100644 index 0000000000..f1b2ea8d3a --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/stash.js @@ -0,0 +1,29 @@ +// Put test results into Stash +function stashResultsThenClose(key, results) { + fetch(`/scroll-to-text-fragment/stash.py?key=${key}`, { + method: 'POST', + body: JSON.stringify(results) + }).then(() => { + window.close(); + }); +} + +// Fetch test results from the Stash +function fetchResults(key, resolve, reject) { + fetch(`/scroll-to-text-fragment/stash.py?key=${key}`).then(response => { + return response.text(); + }).then(text => { + if (text) { + try { + const results = JSON.parse(text); + resolve(results); + } catch(e) { + reject(); + } + } else { + // We keep trying to fetch results as the target page may not have stashed + // them yet. + fetchResults(key, resolve, reject); + } + }); +} diff --git a/testing/web-platform/tests/scroll-to-text-fragment/stash.py b/testing/web-platform/tests/scroll-to-text-fragment/stash.py new file mode 100644 index 0000000000..f66f32ad8d --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/stash.py @@ -0,0 +1,13 @@ +import time + +def main(request, response): + key = request.GET.first(b"key") + + if request.method == u"POST": + # Received result data from target page + request.server.stash.put(key, request.body, u'/scroll-to-text-fragment/') + return u"ok" + else: + # Request for result data from test page + value = request.server.stash.take(key, u'/scroll-to-text-fragment/') + return value -- cgit v1.2.3