Unified · Split
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | .notice, |
| 31 | 31 | .warning, |
| 32 | 32 | .overheadIndicator, |
| 33 | + .blockIndicator, | |
| 33 | 34 | .syntaxbox, // CSS, JavaScript |
| 34 | 35 | .twopartsyntaxbox, // CSS |
| 35 | 36 | .inheritsbox, // JavaScript |
| @@ -104,4 +105,28 @@ · 68 unmodified lines | ||
| 104 | 105 | .cleared { clear: both; } // CSS/box-shadow |
| 105 | 106 | |
| 106 | 107 | code > strong { font-weight: normal; } |
| 108 | + | |
| 109 | + // Compatibility tablees | |
| 110 | + | |
| 111 | + .bc-github-link { | |
| 112 | + float: right; | |
| 113 | + font-size: .75rem; | |
| 114 | + } | |
| 115 | + | |
| 116 | + .bc-supports-yes, .bc-supports-yes + dd, .bc-supports-yes + dd + dd { background: var(--noteGreenBackground); } | |
| 117 | + .bc-supports-partial, .bc-supports-partial + dd, .bc-supports-partial + dd + dd { background: var(--noteOrangeBackground); } | |
| 118 | + .bc-supports-no, .bc-supports-no + dd, .bc-supports-no + dd + dd { background: var(--noteRedBackground); } | |
| 119 | + | |
| 120 | + .bc-table { | |
| 121 | + min-width: 100%; | |
| 122 | + | |
| 123 | + dl { | |
| 124 | + margin: .25rem 0 0; | |
| 125 | + padding: .25rem 0 0; | |
| 126 | + font-size: .75rem; | |
| 127 | + border-top: 1px solid var(--boxBorder); | |
| 128 | + } | |
| 129 | + | |
| 130 | + dd { margin: 0; } | |
| 131 | + } | |
| 107 | 132 | } |
| @@ -6,13 +6,16 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | 'CSS_Background_and_Borders' => 'Backgrounds & Borders', |
| 7 | 7 | 'CSS_Columns' => 'Multi-column Layout', |
| 8 | 8 | 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', |
| 9 | + 'CSS_Fonts' => 'Fonts', | |
| 9 | 10 | 'CSS_Grid_Layout' => 'Grid Layout', |
| 10 | 11 | 'CSS_Images' => 'Images', |
| 11 | 12 | 'CSS_Lists_and_Counters' => 'Lists', |
| 12 | 13 | 'CSS_Transforms' => 'Transforms', |
| 13 | 14 | 'Media_Queries' => 'Media Queries', |
| 15 | + 'filter-function' => 'Filter Effects', | |
| 14 | 16 | 'transform-function' => 'Transforms', |
| 15 | 17 | '@media' => 'Media Queries', |
| 18 | + 'overscroll' => 'Overscroll', | |
| 16 | 19 | 'text-size-adjust' => 'Miscellaneous', |
| 17 | 20 | 'resolved_value' => 'Miscellaneous', |
| 18 | 21 | 'touch-action' => 'Miscellaneous', |
| @@ -42,7 +45,7 @@ module Docs · 23 unmodified lines | ||
| 42 | 45 | end |
| 43 | 46 | |
| 44 | 47 | def get_type |
| 45 | − if slug.include?('-webkit') || slug.include?('-moz') | |
| 48 | + if slug.include?('-webkit') || slug.include?('-moz') || slug.include?('-ms') | |
| 46 | 49 | 'Extensions' |
| 47 | 50 | elsif type = TYPE_BY_PATH[slug.split('/').first] |
| 48 | 51 | type |
| @@ -66,19 +69,22 @@ module Docs · 17 unmodified lines | ||
| 66 | 69 | 'Pseudo-Elements' |
| 67 | 70 | elsif name.start_with?(':') |
| 68 | 71 | 'Selectors' |
| 72 | + elsif name.start_with?('display-') | |
| 73 | + 'Display' | |
| 69 | 74 | else |
| 70 | 75 | 'Miscellaneous' |
| 71 | 76 | end |
| 72 | 77 | end |
| 73 | 78 | |
| 74 | 79 | STATUSES = { |
| 75 | − 'spec-Living' => 0, | |
| 76 | − 'spec-REC' => 1, | |
| 77 | − 'spec-CR' => 2, | |
| 78 | − 'spec-PR' => 3, | |
| 79 | − 'spec-LC' => 4, | |
| 80 | − 'spec-WD' => 5, | |
| 81 | − 'spec-ED' => 6 | |
| 80 | + 'spec-Living' => 0, | |
| 81 | + 'spec-REC' => 1, | |
| 82 | + 'spec-CR' => 2, | |
| 83 | + 'spec-PR' => 3, | |
| 84 | + 'spec-LC' => 4, | |
| 85 | + 'spec-WD' => 5, | |
| 86 | + 'spec-ED' => 6, | |
| 87 | + 'spec-Obsolete' => 7 | |
| 82 | 88 | } |
| 83 | 89 | |
| 84 | 90 | PRIORITY_STATUSES = %w(spec-REC spec-CR) |
| @@ -86,6 +92,7 @@ module Docs · 1 unmodified line | ||
| 86 | 92 | |
| 87 | 93 | def get_spec |
| 88 | 94 | return unless table = at_css('#Specifications + table') || css('.standard-table').last |
| 95 | + | |
| 89 | 96 | specs = table.css('tbody tr').to_a |
| 90 | 97 | # [link, span] |
| 91 | 98 | specs.map! { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] } |
| @@ -110,8 +117,8 @@ module Docs · 18 unmodified lines | ||
| 110 | 117 | 'shape' => [ |
| 111 | 118 | %w(rect() Syntax) ], |
| 112 | 119 | 'timing-function' => [ |
| 113 | − %w(cubic-bezier() The_cubic-bezier()_class_of_timing-functions), | |
| 114 | − %w(steps() The_steps()_class_of_timing-functions), | |
| 120 | + %w(cubic-bezier()), | |
| 121 | + %w(steps()), | |
| 115 | 122 | %w(linear linear), |
| 116 | 123 | %w(ease ease), |
| 117 | 124 | %w(ease-in ease-in), |
| @@ -30,7 +30,7 @@ module Docs · 29 unmodified lines | ||
| 30 | 30 | end |
| 31 | 31 | |
| 32 | 32 | # Remove <div> wrapping .overheadIndicator |
| 33 | − css('div > .overheadIndicator:first-child:last-child').each do |node| | |
| 33 | + css('div > .overheadIndicator:first-child:last-child', 'div > .blockIndicator:first-child:last-child').each do |node| | |
| 34 | 34 | node.parent.replace(node) |
| 35 | 35 | end |
| 36 | 36 | |
| @@ -6,6 +6,7 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | 'EXT_' => 'WebGL', |
| 7 | 7 | 'OES_' => 'WebGL', |
| 8 | 8 | 'WEBGL_' => 'WebGL', |
| 9 | + 'Sensor API' => 'Sensors', | |
| 9 | 10 | 'Ambient Light' => 'Ambient Light', |
| 10 | 11 | 'Audio' => 'Audio', |
| 11 | 12 | 'Battery Status' => 'Battery Status', |
| @@ -22,10 +23,12 @@ module Docs · 10 unmodified lines | ||
| 22 | 23 | 'Encrypted Media Extensions' => 'Encrypted Media', |
| 23 | 24 | 'Fetch' => 'Fetch', |
| 24 | 25 | 'File API' => 'File', |
| 26 | + 'Fullscreen' => 'Fullscreen', | |
| 25 | 27 | 'Geolocation' => 'Geolocation', |
| 26 | 28 | 'Geometry' => 'Geometry', |
| 27 | 29 | 'High Resolution Time' => 'Performance', |
| 28 | 30 | 'Intersection' => 'Intersection Observer', |
| 31 | + 'Keyboard' => 'Keyboard', | |
| 29 | 32 | 'Media Capabilities' => 'Media', |
| 30 | 33 | 'Media Capture' => 'Media', |
| 31 | 34 | 'Media Session' => 'Media', |
| @@ -35,6 +38,7 @@ module Docs · 3 unmodified lines | ||
| 35 | 38 | 'MIDI' => 'Audio', |
| 36 | 39 | 'Navigation Timing' => 'Performance', |
| 37 | 40 | 'Network Information' => 'Network Information', |
| 41 | + 'Orientation Sensor' => 'Sensors', | |
| 38 | 42 | 'Payment' => 'Payments', |
| 39 | 43 | 'Performance Timeline' => 'Performance', |
| 40 | 44 | 'Pointer Events' => 'Pointer Events', |
| @@ -53,11 +57,13 @@ module Docs · 12 unmodified lines | ||
| 53 | 57 | 'Web App Manifest' => 'Web App Manifest', |
| 54 | 58 | 'Budget' => 'Budget', |
| 55 | 59 | 'Web Authentication' => 'Authentication', |
| 60 | + 'Web Locks' => 'Locks', | |
| 56 | 61 | 'Web Workers' => 'Web Workers', |
| 57 | 62 | 'WebGL' => 'WebGL', |
| 58 | 63 | 'WebRTC' => 'WebRTC', |
| 59 | 64 | 'WebUSB' => 'WebUSB', |
| 60 | − 'WebVR' => 'WebVR' } | |
| 65 | + 'WebVR' => 'WebVR', | |
| 66 | + 'WebVTT' => 'WebVTT' } | |
| 61 | 67 | |
| 62 | 68 | TYPE_BY_NAME_STARTS_WITH = { |
| 63 | 69 | 'AbortController' => 'Fetch', |
| @@ -89,10 +95,12 @@ module Docs · 25 unmodified lines | ||
| 89 | 95 | 'Fetch' => 'Fetch', |
| 90 | 96 | 'File' => 'File', |
| 91 | 97 | 'GlobalEventHandlers' => 'GlobalEventHandlers', |
| 98 | + 'HMDVR' => 'WebVR', | |
| 92 | 99 | 'history' => 'History', |
| 93 | 100 | 'HTML Drag' => 'Drag & Drop', |
| 94 | 101 | 'HTML' => 'Elements', |
| 95 | 102 | 'IDB' => 'IndexedDB', |
| 103 | + 'Keyboard' => 'Keyboard', | |
| 96 | 104 | 'location' => 'Location', |
| 97 | 105 | 'navigator' => 'Navigator', |
| 98 | 106 | 'MediaKeySession' => 'Encrypted Media', |
| @@ -122,6 +130,7 @@ module Docs · 23 unmodified lines | ||
| 122 | 130 | 'StyleSheet' => 'CSS', |
| 123 | 131 | 'Stylesheet' => 'CSS', |
| 124 | 132 | 'SVG' => 'SVG', |
| 133 | + 'TextTrack' => 'WebVTT', | |
| 125 | 134 | 'TimeRanges' => 'Media', |
| 126 | 135 | 'timing' => 'Performance', |
| 127 | 136 | 'Timing' => 'Performance', |
| @@ -160,6 +169,7 @@ module Docs · 32 unmodified lines | ||
| 160 | 169 | 'timing' => 'Performance', |
| 161 | 170 | 'Timing' => 'Performance', |
| 162 | 171 | 'udio' => 'Audio', |
| 172 | + 'VRDevice' => 'WebVR', | |
| 163 | 173 | 'WebGL' => 'WebGL', |
| 164 | 174 | 'WEBGL' => 'WebGL', |
| 165 | 175 | 'WebRTC' => 'WebRTC', |
| @@ -239,7 +249,7 @@ module Docs · 73 unmodified lines | ||
| 239 | 249 | |
| 240 | 250 | def include_default_entry? |
| 241 | 251 | return true if type == 'Console' |
| 242 | − return true unless node = doc.at_css('.overheadIndicator') | |
| 252 | + return true unless node = doc.at_css('.overheadIndicator, .blockIndicator') | |
| 243 | 253 | node = node.parent while node.parent != doc |
| 244 | 254 | return true if node.previous_element.try(:name).in?(%w(h2 h3)) |
| 245 | 255 | content = node.content |
| @@ -28,7 +28,7 @@ module Docs · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | def include_default_entry? |
| 30 | 30 | return false if %w(Element/Heading_Elements).include?(slug) |
| 31 | − (node = doc.at_css '.overheadIndicator').nil? || node.content.exclude?('not on a standards track') | |
| 31 | + (node = doc.at_css '.overheadIndicator, .blockIndicator').nil? || node.content.exclude?('not on a standards track') | |
| 32 | 32 | end |
| 33 | 33 | |
| 34 | 34 | def additional_entries |
| @@ -11,12 +11,12 @@ module Docs · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | def other |
| 13 | 13 | # Remove "style" attribute |
| 14 | − css('.inheritsbox', '.overheadIndicator').each do |node| | |
| 14 | + css('.inheritsbox', '.overheadIndicator', '.blockIndicator').each do |node| | |
| 15 | 15 | node.remove_attribute 'style' |
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | # Remove <div> wrapping .overheadIndicator |
| 19 | − css('div > .overheadIndicator:first-child:last-child').each do |node| | |
| 19 | + css('div > .overheadIndicator:first-child:last-child', 'div > .blockIndicator:first-child:last-child').each do |node| | |
| 20 | 20 | node.parent.replace(node) |
| 21 | 21 | end |
| 22 | 22 | end |
| @@ -88,7 +88,7 @@ module Docs · 87 unmodified lines | ||
| 88 | 88 | end |
| 89 | 89 | |
| 90 | 90 | def include_default_entry? |
| 91 | − node = doc.at_css '.overheadIndicator, .warning' | |
| 91 | + node = doc.at_css '.blockIndicator, .warning' | |
| 92 | 92 | |
| 93 | 93 | # Can't use :first-child because #doc is a DocumentFragment |
| 94 | 94 | return true unless node && node.parent == doc && !node.previous_element |
| @@ -14,6 +14,8 @@ module Docs · 13 unmodified lines | ||
| 14 | 14 | '#Quick_Links', |
| 15 | 15 | 'hr'] |
| 16 | 16 | |
| 17 | + BROWSER_UNNECESSARY_CLASS_REGEX = /\s*bc-browser[\w_-]+/ | |
| 18 | + | |
| 17 | 19 | def call |
| 18 | 20 | css(*REMOVE_NODES).remove |
| 19 | 21 | |
| @@ -61,6 +63,94 @@ module Docs · 41 unmodified lines | ||
| 61 | 63 | node.previous_element << node |
| 62 | 64 | end |
| 63 | 65 | |
| 66 | + # New compatibility tables | |
| 67 | + | |
| 68 | + css('.bc-data #Legend + dl', '.bc-data #Legend', '.bc-data #Legend_2 + dl', '.bc-data #Legend_2', '.bc-browser-name').remove | |
| 69 | + | |
| 70 | + css('abbr.only-icon[title="Full support"]', | |
| 71 | + 'abbr.only-icon[title="Partial support"]', | |
| 72 | + 'abbr.only-icon[title="No support"]', | |
| 73 | + 'abbr.only-icon[title="See implementation notes"]').remove | |
| 74 | + | |
| 75 | + css('.bc-data .ic-altname', '.bc-data .ic-deprecated', '.bc-data .ic-non-standard', '.bc-data .ic-experimental').each do |node| | |
| 76 | + node.parent.remove | |
| 77 | + end | |
| 78 | + | |
| 79 | + css('abbr.only-icon').each do |node| | |
| 80 | + node.replace(node.content) | |
| 81 | + end | |
| 82 | + | |
| 83 | + css('.bc-table .bc-platforms td', '.bc-table .bc-browsers td').each do |node| | |
| 84 | + node.name = 'th' | |
| 85 | + end | |
| 86 | + | |
| 87 | + css('.bc-data').each do |node| | |
| 88 | + link = node.at_css('.bc-github-link') | |
| 89 | + prev = node.previous_element | |
| 90 | + prev = prev.previous_element until prev.name == 'h2' | |
| 91 | + prev.add_child(link) | |
| 92 | + | |
| 93 | + node.before(node.children).remove | |
| 94 | + end | |
| 95 | + | |
| 96 | + css('.bc-table').each do |node| | |
| 97 | + desktop_table = node | |
| 98 | + | |
| 99 | + mobile_table = node.dup | |
| 100 | + desktop_table.after(mobile_table) | |
| 101 | + | |
| 102 | + if desktop_table.at_css('.bc-platform-server') | |
| 103 | + server_table = node.dup | |
| 104 | + mobile_table.after(server_table) | |
| 105 | + end | |
| 106 | + | |
| 107 | + desktop_columns = desktop_table.at_css('th.bc-platform-desktop')['colspan'].to_i | |
| 108 | + mobile_columns = desktop_table.at_css('th.bc-platform-mobile')['colspan'].to_i | |
| 109 | + | |
| 110 | + desktop_table.css('.bc-platform-mobile').remove | |
| 111 | + desktop_table.css('.bc-platform-server').remove | |
| 112 | + desktop_table.css('.bc-browsers th').to_a[(desktop_columns + 1)..-1].each(&:remove) | |
| 113 | + desktop_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | |
| 114 | + line.css('td').to_a[(desktop_columns)..-1].each(&:remove) | |
| 115 | + end | |
| 116 | + | |
| 117 | + mobile_table.css('.bc-platform-desktop').remove | |
| 118 | + mobile_table.css('.bc-platform-server').remove | |
| 119 | + mobile_table.css('.bc-browsers th').to_a[1..(desktop_columns)].each(&:remove) | |
| 120 | + mobile_table.css('.bc-browsers th').to_a[(mobile_columns + 1)..-1].each(&:remove) | |
| 121 | + mobile_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | |
| 122 | + line.css('td').to_a[0..(desktop_columns - 1)].each(&:remove) | |
| 123 | + line.css('td').to_a[(mobile_columns)..-1].each(&:remove) | |
| 124 | + end | |
| 125 | + | |
| 126 | + if server_table | |
| 127 | + server_table.css('.bc-platform-desktop').remove | |
| 128 | + server_table.css('.bc-platform-mobile').remove | |
| 129 | + server_table.css('.bc-browsers th').to_a[1..(desktop_columns + mobile_columns)].each(&:remove) | |
| 130 | + server_table.css('tr:not(.bc-platforms):not(.bc-browsers)').each do |line| | |
| 131 | + line.css('td').to_a[0..(desktop_columns + mobile_columns - 1)].each(&:remove) | |
| 132 | + end | |
| 133 | + end | |
| 134 | + end | |
| 135 | + | |
| 136 | + # Reduce page size to make the offline bundle smaller. | |
| 137 | + css('.bc-supports-unknown').remove_attr('class') | |
| 138 | + css('td[class*="bc-platform"], th[class*="bc-platform"]').remove_attr('class') | |
| 139 | + css('td[class*="bc-browser"], th[class*="bc-browser"]').each do |node| | |
| 140 | + class_name = node['class'] | |
| 141 | + class_name.remove!(BROWSER_UNNECESSARY_CLASS_REGEX) | |
| 142 | + | |
| 143 | + if class_name.present? | |
| 144 | + node['class'] = class_name | |
| 145 | + else | |
| 146 | + node.remove_attribute('class') | |
| 147 | + end | |
| 148 | + end | |
| 149 | + | |
| 150 | + css('abbr[title*="Compatibility unknown"]').each do |node| | |
| 151 | + node.before(node.children).remove | |
| 152 | + end | |
| 153 | + | |
| 64 | 154 | doc |
| 65 | 155 | end |
| 66 | 156 | end |