Unified · Split
| @@ -30,6 +30,7 @@ · 29 unmodified lines | |||
| 30 | .notice, | 30 | .notice, |
| 31 | .warning, | 31 | .warning, |
| 32 | .overheadIndicator, | 32 | .overheadIndicator, |
| 33 | .blockIndicator, | ||
| 33 | .syntaxbox, // CSS, JavaScript | 34 | .syntaxbox, // CSS, JavaScript |
| 34 | .twopartsyntaxbox, // CSS | 35 | .twopartsyntaxbox, // CSS |
| 35 | .inheritsbox, // JavaScript | 36 | .inheritsbox, // JavaScript |
| @@ -104,4 +105,28 @@ · 68 unmodified lines | |||
| 104 | .cleared { clear: both; } // CSS/box-shadow | 105 | .cleared { clear: both; } // CSS/box-shadow |
| 105 | 106 | ||
| 106 | code > strong { font-weight: normal; } | 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 | 'CSS_Background_and_Borders' => 'Backgrounds & Borders', | 6 | 'CSS_Background_and_Borders' => 'Backgrounds & Borders', |
| 7 | 'CSS_Columns' => 'Multi-column Layout', | 7 | 'CSS_Columns' => 'Multi-column Layout', |
| 8 | 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', | 8 | 'CSS_Flexible_Box_Layout' => 'Flexible Box Layout', |
| 9 | 'CSS_Fonts' => 'Fonts', | ||
| 9 | 'CSS_Grid_Layout' => 'Grid Layout', | 10 | 'CSS_Grid_Layout' => 'Grid Layout', |
| 10 | 'CSS_Images' => 'Images', | 11 | 'CSS_Images' => 'Images', |
| 11 | 'CSS_Lists_and_Counters' => 'Lists', | 12 | 'CSS_Lists_and_Counters' => 'Lists', |
| 12 | 'CSS_Transforms' => 'Transforms', | 13 | 'CSS_Transforms' => 'Transforms', |
| 13 | 'Media_Queries' => 'Media Queries', | 14 | 'Media_Queries' => 'Media Queries', |
| 15 | 'filter-function' => 'Filter Effects', | ||
| 14 | 'transform-function' => 'Transforms', | 16 | 'transform-function' => 'Transforms', |
| 15 | '@media' => 'Media Queries', | 17 | '@media' => 'Media Queries', |
| 18 | 'overscroll' => 'Overscroll', | ||
| 16 | 'text-size-adjust' => 'Miscellaneous', | 19 | 'text-size-adjust' => 'Miscellaneous', |
| 17 | 'resolved_value' => 'Miscellaneous', | 20 | 'resolved_value' => 'Miscellaneous', |
| 18 | 'touch-action' => 'Miscellaneous', | 21 | 'touch-action' => 'Miscellaneous', |
| @@ -42,7 +45,7 @@ module Docs · 23 unmodified lines | |||
| 42 | end | 45 | end |
| 43 | 46 | ||
| 44 | def get_type | 47 | def get_type |
| 45 | if slug.include?('-webkit') || slug.include?('-moz') | 48 | if slug.include?('-webkit') || slug.include?('-moz') || slug.include?('-ms') |
| 46 | 'Extensions' | 49 | 'Extensions' |
| 47 | elsif type = TYPE_BY_PATH[slug.split('/').first] | 50 | elsif type = TYPE_BY_PATH[slug.split('/').first] |
| 48 | type | 51 | type |
| @@ -66,19 +69,22 @@ module Docs · 17 unmodified lines | |||
| 66 | 'Pseudo-Elements' | 69 | 'Pseudo-Elements' |
| 67 | elsif name.start_with?(':') | 70 | elsif name.start_with?(':') |
| 68 | 'Selectors' | 71 | 'Selectors' |
| 72 | elsif name.start_with?('display-') | ||
| 73 | 'Display' | ||
| 69 | else | 74 | else |
| 70 | 'Miscellaneous' | 75 | 'Miscellaneous' |
| 71 | end | 76 | end |
| 72 | end | 77 | end |
| 73 | 78 | ||
| 74 | STATUSES = { | 79 | STATUSES = { |
| 75 | 'spec-Living' => 0, | 80 | 'spec-Living' => 0, |
| 76 | 'spec-REC' => 1, | 81 | 'spec-REC' => 1, |
| 77 | 'spec-CR' => 2, | 82 | 'spec-CR' => 2, |
| 78 | 'spec-PR' => 3, | 83 | 'spec-PR' => 3, |
| 79 | 'spec-LC' => 4, | 84 | 'spec-LC' => 4, |
| 80 | 'spec-WD' => 5, | 85 | 'spec-WD' => 5, |
| 81 | 'spec-ED' => 6 | 86 | 'spec-ED' => 6, |
| 87 | 'spec-Obsolete' => 7 | ||
| 82 | } | 88 | } |
| 83 | 89 | ||
| 84 | PRIORITY_STATUSES = %w(spec-REC spec-CR) | 90 | PRIORITY_STATUSES = %w(spec-REC spec-CR) |
| @@ -86,6 +92,7 @@ module Docs · 1 unmodified line | |||
| 86 | 92 | ||
| 87 | def get_spec | 93 | def get_spec |
| 88 | return unless table = at_css('#Specifications + table') || css('.standard-table').last | 94 | return unless table = at_css('#Specifications + table') || css('.standard-table').last |
| 95 | |||
| 89 | specs = table.css('tbody tr').to_a | 96 | specs = table.css('tbody tr').to_a |
| 90 | # [link, span] | 97 | # [link, span] |
| 91 | specs.map! { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] } | 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 | 'shape' => [ | 117 | 'shape' => [ |
| 111 | %w(rect() Syntax) ], | 118 | %w(rect() Syntax) ], |
| 112 | 'timing-function' => [ | 119 | 'timing-function' => [ |
| 113 | %w(cubic-bezier() The_cubic-bezier()_class_of_timing-functions), | 120 | %w(cubic-bezier()), |
| 114 | %w(steps() The_steps()_class_of_timing-functions), | 121 | %w(steps()), |
| 115 | %w(linear linear), | 122 | %w(linear linear), |
| 116 | %w(ease ease), | 123 | %w(ease ease), |
| 117 | %w(ease-in ease-in), | 124 | %w(ease-in ease-in), |
| @@ -30,7 +30,7 @@ module Docs · 29 unmodified lines | |||
| 30 | end | 30 | end |
| 31 | 31 | ||
| 32 | # Remove <div> wrapping .overheadIndicator | 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 | node.parent.replace(node) | 34 | node.parent.replace(node) |
| 35 | end | 35 | end |
| 36 | 36 | ||
| @@ -6,6 +6,7 @@ module Docs · 5 unmodified lines | |||
| 6 | 'EXT_' => 'WebGL', | 6 | 'EXT_' => 'WebGL', |
| 7 | 'OES_' => 'WebGL', | 7 | 'OES_' => 'WebGL', |
| 8 | 'WEBGL_' => 'WebGL', | 8 | 'WEBGL_' => 'WebGL', |
| 9 | 'Sensor API' => 'Sensors', | ||
| 9 | 'Ambient Light' => 'Ambient Light', | 10 | 'Ambient Light' => 'Ambient Light', |
| 10 | 'Audio' => 'Audio', | 11 | 'Audio' => 'Audio', |
| 11 | 'Battery Status' => 'Battery Status', | 12 | 'Battery Status' => 'Battery Status', |
| @@ -22,10 +23,12 @@ module Docs · 10 unmodified lines | |||
| 22 | 'Encrypted Media Extensions' => 'Encrypted Media', | 23 | 'Encrypted Media Extensions' => 'Encrypted Media', |
| 23 | 'Fetch' => 'Fetch', | 24 | 'Fetch' => 'Fetch', |
| 24 | 'File API' => 'File', | 25 | 'File API' => 'File', |
| 26 | 'Fullscreen' => 'Fullscreen', | ||
| 25 | 'Geolocation' => 'Geolocation', | 27 | 'Geolocation' => 'Geolocation', |
| 26 | 'Geometry' => 'Geometry', | 28 | 'Geometry' => 'Geometry', |
| 27 | 'High Resolution Time' => 'Performance', | 29 | 'High Resolution Time' => 'Performance', |
| 28 | 'Intersection' => 'Intersection Observer', | 30 | 'Intersection' => 'Intersection Observer', |
| 31 | 'Keyboard' => 'Keyboard', | ||
| 29 | 'Media Capabilities' => 'Media', | 32 | 'Media Capabilities' => 'Media', |
| 30 | 'Media Capture' => 'Media', | 33 | 'Media Capture' => 'Media', |
| 31 | 'Media Session' => 'Media', | 34 | 'Media Session' => 'Media', |
| @@ -35,6 +38,7 @@ module Docs · 3 unmodified lines | |||
| 35 | 'MIDI' => 'Audio', | 38 | 'MIDI' => 'Audio', |
| 36 | 'Navigation Timing' => 'Performance', | 39 | 'Navigation Timing' => 'Performance', |
| 37 | 'Network Information' => 'Network Information', | 40 | 'Network Information' => 'Network Information', |
| 41 | 'Orientation Sensor' => 'Sensors', | ||
| 38 | 'Payment' => 'Payments', | 42 | 'Payment' => 'Payments', |
| 39 | 'Performance Timeline' => 'Performance', | 43 | 'Performance Timeline' => 'Performance', |
| 40 | 'Pointer Events' => 'Pointer Events', | 44 | 'Pointer Events' => 'Pointer Events', |
| @@ -53,11 +57,13 @@ module Docs · 12 unmodified lines | |||
| 53 | 'Web App Manifest' => 'Web App Manifest', | 57 | 'Web App Manifest' => 'Web App Manifest', |
| 54 | 'Budget' => 'Budget', | 58 | 'Budget' => 'Budget', |
| 55 | 'Web Authentication' => 'Authentication', | 59 | 'Web Authentication' => 'Authentication', |
| 60 | 'Web Locks' => 'Locks', | ||
| 56 | 'Web Workers' => 'Web Workers', | 61 | 'Web Workers' => 'Web Workers', |
| 57 | 'WebGL' => 'WebGL', | 62 | 'WebGL' => 'WebGL', |
| 58 | 'WebRTC' => 'WebRTC', | 63 | 'WebRTC' => 'WebRTC', |
| 59 | 'WebUSB' => 'WebUSB', | 64 | 'WebUSB' => 'WebUSB', |
| 60 | 'WebVR' => 'WebVR' } | 65 | 'WebVR' => 'WebVR', |
| 66 | 'WebVTT' => 'WebVTT' } | ||
| 61 | 67 | ||
| 62 | TYPE_BY_NAME_STARTS_WITH = { | 68 | TYPE_BY_NAME_STARTS_WITH = { |
| 63 | 'AbortController' => 'Fetch', | 69 | 'AbortController' => 'Fetch', |
| @@ -89,10 +95,12 @@ module Docs · 25 unmodified lines | |||
| 89 | 'Fetch' => 'Fetch', | 95 | 'Fetch' => 'Fetch', |
| 90 | 'File' => 'File', | 96 | 'File' => 'File', |
| 91 | 'GlobalEventHandlers' => 'GlobalEventHandlers', | 97 | 'GlobalEventHandlers' => 'GlobalEventHandlers', |
| 98 | 'HMDVR' => 'WebVR', | ||
| 92 | 'history' => 'History', | 99 | 'history' => 'History', |
| 93 | 'HTML Drag' => 'Drag & Drop', | 100 | 'HTML Drag' => 'Drag & Drop', |
| 94 | 'HTML' => 'Elements', | 101 | 'HTML' => 'Elements', |
| 95 | 'IDB' => 'IndexedDB', | 102 | 'IDB' => 'IndexedDB', |
| 103 | 'Keyboard' => 'Keyboard', | ||
| 96 | 'location' => 'Location', | 104 | 'location' => 'Location', |
| 97 | 'navigator' => 'Navigator', | 105 | 'navigator' => 'Navigator', |
| 98 | 'MediaKeySession' => 'Encrypted Media', | 106 | 'MediaKeySession' => 'Encrypted Media', |
| @@ -122,6 +130,7 @@ module Docs · 23 unmodified lines | |||
| 122 | 'StyleSheet' => 'CSS', | 130 | 'StyleSheet' => 'CSS', |
| 123 | 'Stylesheet' => 'CSS', | 131 | 'Stylesheet' => 'CSS', |
| 124 | 'SVG' => 'SVG', | 132 | 'SVG' => 'SVG', |
| 133 | 'TextTrack' => 'WebVTT', | ||
| 125 | 'TimeRanges' => 'Media', | 134 | 'TimeRanges' => 'Media', |
| 126 | 'timing' => 'Performance', | 135 | 'timing' => 'Performance', |
| 127 | 'Timing' => 'Performance', | 136 | 'Timing' => 'Performance', |
| @@ -160,6 +169,7 @@ module Docs · 32 unmodified lines | |||
| 160 | 'timing' => 'Performance', | 169 | 'timing' => 'Performance', |
| 161 | 'Timing' => 'Performance', | 170 | 'Timing' => 'Performance', |
| 162 | 'udio' => 'Audio', | 171 | 'udio' => 'Audio', |
| 172 | 'VRDevice' => 'WebVR', | ||
| 163 | 'WebGL' => 'WebGL', | 173 | 'WebGL' => 'WebGL', |
| 164 | 'WEBGL' => 'WebGL', | 174 | 'WEBGL' => 'WebGL', |
| 165 | 'WebRTC' => 'WebRTC', | 175 | 'WebRTC' => 'WebRTC', |
| @@ -239,7 +249,7 @@ module Docs · 73 unmodified lines | |||
| 239 | 249 | ||
| 240 | def include_default_entry? | 250 | def include_default_entry? |
| 241 | return true if type == 'Console' | 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 | node = node.parent while node.parent != doc | 253 | node = node.parent while node.parent != doc |
| 244 | return true if node.previous_element.try(:name).in?(%w(h2 h3)) | 254 | return true if node.previous_element.try(:name).in?(%w(h2 h3)) |
| 245 | content = node.content | 255 | content = node.content |
| @@ -28,7 +28,7 @@ module Docs · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | def include_default_entry? | 29 | def include_default_entry? |
| 30 | return false if %w(Element/Heading_Elements).include?(slug) | 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 | end | 32 | end |
| 33 | 33 | ||
| 34 | def additional_entries | 34 | def additional_entries |
| @@ -11,12 +11,12 @@ module Docs · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | def other | 12 | def other |
| 13 | # Remove "style" attribute | 13 | # Remove "style" attribute |
| 14 | css('.inheritsbox', '.overheadIndicator').each do |node| | 14 | css('.inheritsbox', '.overheadIndicator', '.blockIndicator').each do |node| |
| 15 | node.remove_attribute 'style' | 15 | node.remove_attribute 'style' |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | # Remove <div> wrapping .overheadIndicator | 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 | node.parent.replace(node) | 20 | node.parent.replace(node) |
| 21 | end | 21 | end |
| 22 | end | 22 | end |
| @@ -88,7 +88,7 @@ module Docs · 87 unmodified lines | |||
| 88 | end | 88 | end |
| 89 | 89 | ||
| 90 | def include_default_entry? | 90 | def include_default_entry? |
| 91 | node = doc.at_css '.overheadIndicator, .warning' | 91 | node = doc.at_css '.blockIndicator, .warning' |
| 92 | 92 | ||
| 93 | # Can't use :first-child because #doc is a DocumentFragment | 93 | # Can't use :first-child because #doc is a DocumentFragment |
| 94 | return true unless node && node.parent == doc && !node.previous_element | 94 | return true unless node && node.parent == doc && !node.previous_element |
| @@ -14,6 +14,8 @@ module Docs · 13 unmodified lines | |||
| 14 | '#Quick_Links', | 14 | '#Quick_Links', |
| 15 | 'hr'] | 15 | 'hr'] |
| 16 | 16 | ||
| 17 | BROWSER_UNNECESSARY_CLASS_REGEX = /\s*bc-browser[\w_-]+/ | ||
| 18 | |||
| 17 | def call | 19 | def call |
| 18 | css(*REMOVE_NODES).remove | 20 | css(*REMOVE_NODES).remove |
| 19 | 21 | ||
| @@ -61,6 +63,94 @@ module Docs · 41 unmodified lines | |||
| 61 | node.previous_element << node | 63 | node.previous_element << node |
| 62 | end | 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 | doc | 154 | doc |
| 65 | end | 155 | end |
| 66 | end | 156 | end |