-
-
Save koji-nakamura-classi/aac4ea9ba6ed5acdd8819bd6fc5ba11f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| class Listener < Nokogiri::XML::SAX::Document | |
| def initialize | |
| @elements = [] | |
| @dfn_element = false | |
| @dt = nil | |
| @text = nil | |
| @result = {} | |
| end | |
| # テキストノード | |
| def characters(string) | |
| @text << string if @text | |
| end | |
| # 開始タグ | |
| def start_element(name, attrs = []) | |
| if name == "dfn" && attrs.to_h.key?("element") | |
| @dfn_element = true | |
| @text = +"" | |
| end | |
| if %w|dl dt dd|.include?(name) && @elements.any? | |
| @text = +"" | |
| end | |
| end | |
| def end_element(name) | |
| if name == "dfn" && @dfn_element | |
| @elements << @text.strip | |
| @dfn_element = false | |
| @text = nil | |
| end | |
| if name == "dt" && @text | |
| @dt = @text.strip | |
| end | |
| if name == "dd" && @text | |
| if ["Categories:", "Content model:"].include?(@dt) | |
| @elements.each do |el| | |
| @result[el] ||= {} | |
| @result[el][@dt] ||= [] | |
| @result[el][@dt] << @text.strip | |
| end | |
| end | |
| end | |
| if name == "dl" && @elements.any? | |
| @elements = [] | |
| @dt = nil | |
| @text = nil | |
| end | |
| end | |
| attr_reader :result | |
| end | |
| html = File.open('source') | |
| listener = Listener.new | |
| parser = Nokogiri::HTML::SAX::Parser.new(listener) | |
| parser.parse(html) | |
| result = listener.result.map do |element, info| | |
| categories = info["Categories:"].map do |cat| | |
| case cat | |
| when "Flow content." | |
| "flow" | |
| when "Phrasing content." | |
| "phrasing" | |
| # when "Embedded content." | |
| # "embedded" | |
| # when "Interactive content." | |
| # "interactive" | |
| # when "Metadata content." | |
| # "metadata" | |
| # when "Sectioning content." | |
| # "sectioning" | |
| # when "Heading content." | |
| # "heading" | |
| # when "Palpable content" | |
| # "palpable" | |
| end | |
| end.compact | |
| content_model = info["Content model:"].map do |cm| | |
| case cm | |
| when "Flow content." | |
| "flow" | |
| when "Phrasing content." | |
| "phrasing" | |
| when "Transparent" | |
| "transparent" | |
| else | |
| cm | |
| end.gsub(/\s+/, ' ').strip | |
| end | |
| [element, { categories:, contentModel: content_model }] | |
| end.to_h | |
| class TocListener < Nokogiri::XML::SAX::Document | |
| def initialize | |
| @result = {} | |
| end | |
| def start_element(name, attrs = []) | |
| if name == "a" && attrs.to_h.key?("href") | |
| href = attrs.to_h["href"] | |
| hash = href.split("#")[1] | |
| if /^the-(.*)-elements?$/ =~ hash | |
| element = Regexp.last_match(1) | |
| link = href | |
| unless result.key?(element) | |
| result[element] = { "link" => "https://html.spec.whatwg.org/multipage/#{link}" } | |
| end | |
| end | |
| end | |
| end | |
| attr_reader :result | |
| end | |
| toc_html = File.open('spec_toc.html') | |
| toc_listener = TocListener.new | |
| toc_parser = Nokogiri::HTML::SAX::Parser.new(toc_listener) | |
| toc_parser.parse(toc_html) | |
| toc_listener.result.each do |element, info| | |
| if result.key?(element) | |
| result[element]["link"] = info["link"] | |
| elsif element == "h1,-h2,-h3,-h4,-h5,-and-h6" | |
| result["h1"]["link"] = info["link"] | |
| result["h2"]["link"] = info["link"] | |
| result["h3"]["link"] = info["link"] | |
| result["h4"]["link"] = info["link"] | |
| result["h5"]["link"] = info["link"] | |
| result["h6"]["link"] = info["link"] | |
| elsif element == "sub-and-sup" | |
| result["sub"]["link"] = info["link"] | |
| result["sup"]["link"] = info["link"] | |
| end | |
| end | |
| require 'json' | |
| puts JSON.pretty_generate(result) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "html": { | |
| "categories": [], | |
| "contentModel": [ | |
| "A head element followed by a body element." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-html-element" | |
| }, | |
| "head": { | |
| "categories": [], | |
| "contentModel": [ | |
| "If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a title element and no more than one is a base element.", | |
| "Otherwise: One or more elements of metadata content, of which exactly one is a title element and no more than one is a base element." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-head-element" | |
| }, | |
| "title": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Text that is not inter-element whitespace." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-title-element" | |
| }, | |
| "base": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-base-element" | |
| }, | |
| "link": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-link-element" | |
| }, | |
| "meta": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element" | |
| }, | |
| "style": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Text that gives a conformant style sheet." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/semantics.html#the-style-element" | |
| }, | |
| "body": { | |
| "categories": [], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-body-element" | |
| }, | |
| "article": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-article-element" | |
| }, | |
| "section": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-section-element" | |
| }, | |
| "nav": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-nav-element" | |
| }, | |
| "aside": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-aside-element" | |
| }, | |
| "h1": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "h2": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "h3": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "h4": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "h5": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "h6": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements" | |
| }, | |
| "hgroup": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Zero or more p elements, followed by one h1, h2, h3, h4, h5, or h6 element, followed by zero or more p elements, optionally intermixed with script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-hgroup-element" | |
| }, | |
| "header": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Flow content, but with no header or footer element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-header-element" | |
| }, | |
| "footer": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Flow content, but with no header or footer element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-footer-element" | |
| }, | |
| "address": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Flow content, but with no heading content descendants, no sectioning content descendants, and no header, footer, or address element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/sections.html#the-address-element" | |
| }, | |
| "p": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element" | |
| }, | |
| "hr": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-hr-element" | |
| }, | |
| "pre": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element" | |
| }, | |
| "blockquote": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element" | |
| }, | |
| "ol": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Zero or more li and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element" | |
| }, | |
| "ul": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Zero or more li and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element" | |
| }, | |
| "menu": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Zero or more li and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-menu-element" | |
| }, | |
| "li": { | |
| "categories": [], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element" | |
| }, | |
| "dl": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Either: Zero or more groups each consisting of one or more dt elements followed by one or more dd elements, optionally intermixed with script-supporting elements.", | |
| "Or: One or more div elements, optionally intermixed with script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element" | |
| }, | |
| "dt": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Flow content, but with no header, footer, sectioning content, or heading content descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-dt-element" | |
| }, | |
| "dd": { | |
| "categories": [], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-dd-element" | |
| }, | |
| "figure": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Either: one figcaption element followed by flow content.", | |
| "Or: flow content followed by one figcaption element.", | |
| "Or: flow content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-figure-element" | |
| }, | |
| "figcaption": { | |
| "categories": [], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-figcaption-element" | |
| }, | |
| "main": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-main-element" | |
| }, | |
| "search": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-search-element" | |
| }, | |
| "div": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "If the element is a child of a dl element: One or more dt elements followed by one or more dd elements, optionally intermixed with script-supporting elements.", | |
| "Otherwise, if the element is a descendant of an option element: Zero or more option element inner content elements.", | |
| "Otherwise, if the element is a descendant of an optgroup element: Zero or more optgroup element inner content elements.", | |
| "Otherwise, if the element is a descendant of a select element: Zero or more select element inner content elements.", | |
| "Otherwise: flow content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" | |
| }, | |
| "a": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent, but there must be no interactive content descendant, a element descendant, or descendant with the tabindex attribute specified." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element" | |
| }, | |
| "em": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-em-element" | |
| }, | |
| "strong": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-strong-element" | |
| }, | |
| "small": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-small-element" | |
| }, | |
| "s": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-s-element" | |
| }, | |
| "cite": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-cite-element" | |
| }, | |
| "q": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-q-element" | |
| }, | |
| "dfn": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Phrasing content, but there must be no dfn element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-dfn-element" | |
| }, | |
| "abbr": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-abbr-element" | |
| }, | |
| "ruby": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "See prose." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element" | |
| }, | |
| "rt": { | |
| "categories": [], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-rt-element" | |
| }, | |
| "rp": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Text." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-rp-element" | |
| }, | |
| "data": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-data-element" | |
| }, | |
| "time": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "If the element has a datetime attribute: Phrasing content.", | |
| "Otherwise: Text, but must match requirements described in prose below." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-time-element" | |
| }, | |
| "code": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element" | |
| }, | |
| "var": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-var-element" | |
| }, | |
| "samp": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-samp-element" | |
| }, | |
| "kbd": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-kbd-element" | |
| }, | |
| "sub": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-sub-and-sup-elements" | |
| }, | |
| "sup": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-sub-and-sup-elements" | |
| }, | |
| "i": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-i-element" | |
| }, | |
| "b": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-b-element" | |
| }, | |
| "u": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-u-element" | |
| }, | |
| "mark": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-mark-element" | |
| }, | |
| "bdi": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-bdi-element" | |
| }, | |
| "bdo": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-bdo-element" | |
| }, | |
| "span": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "If the element is a descendant of an option element: Zero or more option element inner content elements, except div elements.", | |
| "Otherwise: Phrasing content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element" | |
| }, | |
| "br": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-br-element" | |
| }, | |
| "wbr": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-wbr-element" | |
| }, | |
| "ins": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/edits.html#the-ins-element" | |
| }, | |
| "del": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/edits.html#the-del-element" | |
| }, | |
| "picture": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Zero or more source elements, followed by one img element, optionally intermixed with script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/embedded-content.html#the-picture-element" | |
| }, | |
| "source": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element" | |
| }, | |
| "img": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element" | |
| }, | |
| "iframe": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element" | |
| }, | |
| "embed": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-embed-element" | |
| }, | |
| "object": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element" | |
| }, | |
| "video": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "If the element has a src attribute: zero or more track elements, then transparent, but with no media element descendants.", | |
| "If the element does not have a src attribute: zero or more source elements, then zero or more track elements, then transparent, but with no media element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/media.html#the-video-element" | |
| }, | |
| "audio": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "If the element has a src attribute: zero or more track elements, then transparent, but with no media element descendants.", | |
| "If the element does not have a src attribute: zero or more source elements, then zero or more track elements, then transparent, but with no media element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/media.html#the-audio-element" | |
| }, | |
| "track": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/media.html#the-track-element" | |
| }, | |
| "map": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/image-maps.html#the-map-element" | |
| }, | |
| "area": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element" | |
| }, | |
| "table": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-table-element" | |
| }, | |
| "caption": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Flow content, but with no descendant table elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-caption-element" | |
| }, | |
| "colgroup": { | |
| "categories": [], | |
| "contentModel": [ | |
| "If the span attribute is present: Nothing.", | |
| "If the span attribute is absent: Zero or more col and template elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-colgroup-element" | |
| }, | |
| "col": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-col-element" | |
| }, | |
| "tbody": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Zero or more tr and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-tbody-element" | |
| }, | |
| "thead": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Zero or more tr and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-thead-element" | |
| }, | |
| "tfoot": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Zero or more tr and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-tfoot-element" | |
| }, | |
| "tr": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Zero or more td, th, and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-tr-element" | |
| }, | |
| "td": { | |
| "categories": [], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-td-element" | |
| }, | |
| "th": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Flow content, but with no header, footer, sectioning content, or heading content descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/tables.html#the-th-element" | |
| }, | |
| "form": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Flow content, but with no form element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/forms.html#the-form-element" | |
| }, | |
| "label": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Phrasing content, but with no descendant labelable elements unless it is the element's labeled control, and no descendant label elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/forms.html#the-label-element" | |
| }, | |
| "input": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/input.html#the-input-element" | |
| }, | |
| "button": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Phrasing content, but there must be no interactive content descendant and no descendant with the tabindex attribute specified. If the element is the first child of a select element, then it may also have zero or one descendant selectedcontent element." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element" | |
| }, | |
| "select": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Zero or one button elements if the select is a drop-down box, followed by zero or more select element inner content elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element" | |
| }, | |
| "datalist": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Either: phrasing content.", | |
| "Or: Zero or more option and script-supporting elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-datalist-element" | |
| }, | |
| "optgroup": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Zero or one legend element followed by zero or more optgroup element inner content elements." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-optgroup-element" | |
| }, | |
| "option": { | |
| "categories": [], | |
| "contentModel": [ | |
| "If the element has a label attribute and a value attribute: Nothing.", | |
| "If the element has a label attribute but no value attribute: Text.", | |
| "If the element has no label attribute and is not a descendant of a datalist element: Zero or more option element inner content elements.", | |
| "If the element has no label attribute and is a descendant of a datalist element: Text." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-option-element" | |
| }, | |
| "textarea": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Text." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element" | |
| }, | |
| "output": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "phrasing" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element" | |
| }, | |
| "progress": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Phrasing content, but there must be no progress element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-progress-element" | |
| }, | |
| "meter": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Phrasing content, but there must be no meter element descendants." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-meter-element" | |
| }, | |
| "fieldset": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "Optionally, a legend element, followed by flow content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-fieldset-element" | |
| }, | |
| "legend": { | |
| "categories": [], | |
| "contentModel": [ | |
| "If the element is a child of an optgroup element: Phrasing content, but there must be no interactive content and no descendant with the tabindex attribute.", | |
| "Otherwise: Phrasing content, optionally intermixed with heading content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-legend-element" | |
| }, | |
| "selectedcontent": { | |
| "categories": [ | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/form-elements.html#the-selectedcontent-element" | |
| }, | |
| "details": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "One summary element followed by flow content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element" | |
| }, | |
| "summary": { | |
| "categories": [], | |
| "contentModel": [ | |
| "Phrasing content, optionally intermixed with heading content." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/interactive-elements.html#the-summary-element" | |
| }, | |
| "dialog": { | |
| "categories": [ | |
| "flow" | |
| ], | |
| "contentModel": [ | |
| "flow" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element" | |
| }, | |
| "script": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "If there is no src attribute, depends on the value of the type attribute, but must match script content restrictions.", | |
| "If there is a src attribute, the element must be either empty or contain only script documentation that also matches script content restrictions." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/scripting.html#the-script-element" | |
| }, | |
| "noscript": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "When scripting is disabled, in a head element: in any order, zero or more link elements, zero or more style elements, and zero or more meta elements.", | |
| "When scripting is disabled, not in a head element: transparent, but there must be no noscript element descendants.", | |
| "Otherwise: text that conforms to the requirements given in the prose." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/scripting.html#the-noscript-element" | |
| }, | |
| "template": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Nothing (for clarification, see example)." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/scripting.html#the-template-element" | |
| }, | |
| "slot": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "transparent" | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element" | |
| }, | |
| "canvas": { | |
| "categories": [ | |
| "flow", | |
| "phrasing" | |
| ], | |
| "contentModel": [ | |
| "Transparent, but with no interactive content descendants except for a elements, img elements with usemap attributes, button elements, input elements whose type attribute are in the Checkbox or Radio Button states, input elements that are buttons, and select elements with a multiple attribute or a display size greater than 1." | |
| ], | |
| "link": "https://html.spec.whatwg.org/multipage/canvas.html#the-canvas-element" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment