squoosh 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/squoosh/version.rb +1 -1
- data/lib/squoosh.rb +99 -102
- metadata +53 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45427ad6b7b51207967217770bff4da6dce268769f51117d031a330ca0eeed8f
|
|
4
|
+
data.tar.gz: 9d732e5924249a0cc4cd4b3c0540dfb15839b30a9ab3186cca659bd756b3a03c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4cd2bbc234b4e65955d1ee4a59ab0fcf512875498b1369d4b536f16f9e590ee009a3971639abd37261325c2155e84cb936ffa8947c872088e2745ea7390e57c
|
|
7
|
+
data.tar.gz: 71d98388a6031b518903874fe19dfce2063e015ce986cd462666ebb5a34f9c292d66398b7729ff07eb17d04b1221c7bf88cc2622161de23036f6cd5417edf93b
|
data/lib/squoosh/version.rb
CHANGED
data/lib/squoosh.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require 'uglifier'
|
|
3
|
+
require "squoosh/version"
|
|
4
|
+
require "nokogiri"
|
|
5
|
+
require "sassc"
|
|
6
|
+
require "uglifier"
|
|
8
7
|
|
|
9
8
|
# @author Stephen Checkoway <s@pahtak.org>
|
|
10
9
|
# Minify HTML, JavaScript, and CSS.
|
|
@@ -87,7 +86,7 @@ module Squoosh
|
|
|
87
86
|
# @return [String] the minified HTML
|
|
88
87
|
def minify_html(content)
|
|
89
88
|
doc = Nokogiri.HTML5(content)
|
|
90
|
-
return content unless doc
|
|
89
|
+
return content unless doc.internal_subset&.html5_dtd?
|
|
91
90
|
|
|
92
91
|
remove_comments(doc) if @options[:remove_comments]
|
|
93
92
|
compress_javascript(doc) if @options[:minify_javascript]
|
|
@@ -117,12 +116,11 @@ module Squoosh
|
|
|
117
116
|
|
|
118
117
|
# Element kinds
|
|
119
118
|
VOID_ELEMENTS = Set.new(%w[area base br col embed hr img input
|
|
120
|
-
|
|
119
|
+
keygen link meta param source track wbr]).freeze
|
|
121
120
|
RAW_TEXT_ELEMENTS = Set.new(%w[script style]).freeze
|
|
122
121
|
ESCAPABLE_RAW_TEXT_ELEMENTS = Set.new(%w[textarea title]).freeze
|
|
123
|
-
FOREIGN_ELEMENTS = Set.new(%w[math svg]).freeze
|
|
124
122
|
private_constant :VOID_ELEMENTS, :RAW_TEXT_ELEMENTS
|
|
125
|
-
private_constant :ESCAPABLE_RAW_TEXT_ELEMENTS
|
|
123
|
+
private_constant :ESCAPABLE_RAW_TEXT_ELEMENTS
|
|
126
124
|
|
|
127
125
|
INLINE_SCRIPT_OPTIONS = {
|
|
128
126
|
output: {
|
|
@@ -146,7 +144,8 @@ module Squoosh
|
|
|
146
144
|
end
|
|
147
145
|
|
|
148
146
|
def foreign_element?(node)
|
|
149
|
-
|
|
147
|
+
return false unless node.type == Nokogiri::XML::Node::ELEMENT_NODE
|
|
148
|
+
!node.namespace.nil? && node.namespace.href != "http://www.w3.org/1999/xhtml"
|
|
150
149
|
end
|
|
151
150
|
|
|
152
151
|
def normal_element?(node)
|
|
@@ -166,13 +165,13 @@ module Squoosh
|
|
|
166
165
|
end
|
|
167
166
|
|
|
168
167
|
PHRASING_CONTENT = Set.new(%w[a abbr area audio b bdi bdo br button canvas
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
cite code data datalist del dfn em embed i
|
|
169
|
+
iframe img input ins kbd keygen label link
|
|
170
|
+
map mark math meta meter noscript object
|
|
171
|
+
output picture progress q ruby s samp script
|
|
172
|
+
select slot small span strong sub sup svg
|
|
173
|
+
template textarea time u var video
|
|
174
|
+
wbr]).freeze
|
|
176
175
|
private_constant :PHRASING_CONTENT
|
|
177
176
|
|
|
178
177
|
def phrasing_content?(node)
|
|
@@ -181,7 +180,7 @@ module Squoosh
|
|
|
181
180
|
end
|
|
182
181
|
|
|
183
182
|
def remove_comments(doc)
|
|
184
|
-
doc.xpath(
|
|
183
|
+
doc.xpath("//comment()").each do |node|
|
|
185
184
|
next if preserve_comment?(node)
|
|
186
185
|
|
|
187
186
|
prev_node = node.previous_sibling
|
|
@@ -197,8 +196,8 @@ module Squoosh
|
|
|
197
196
|
|
|
198
197
|
def preserve_comment?(node)
|
|
199
198
|
content = node.content
|
|
200
|
-
return true if content.start_with?
|
|
201
|
-
return true if /\A\s
|
|
199
|
+
return true if content.start_with? "[if "
|
|
200
|
+
return true if /\A\s*!/.match?(content)
|
|
202
201
|
|
|
203
202
|
# Support other retained comments?
|
|
204
203
|
false
|
|
@@ -209,37 +208,37 @@ module Squoosh
|
|
|
209
208
|
# Select all attribute nodes whose names start with "on";
|
|
210
209
|
'//@*[starts-with(name(),"on")]' +
|
|
211
210
|
# and are not descendants of foreign elements
|
|
212
|
-
|
|
211
|
+
"[not(ancestor::math or ancestor::svg)]" +
|
|
213
212
|
# and
|
|
214
|
-
|
|
213
|
+
"[" +
|
|
215
214
|
# whose names are any of
|
|
216
215
|
%w[abort cancel canplay canplaythrough change click close contextmenu
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
cuechange dblclick drag dragend dragenter dragexit dragleave
|
|
217
|
+
dragover dragstart drop durationchange emptied ended input invalid
|
|
218
|
+
keydown keypress keyup loadeddata loadedmetadata loadend loadstart
|
|
219
|
+
mousedown mouseenter mouseleave mousemove mouseout mouseover
|
|
220
|
+
mouseup wheel pause play playing progress ratechange reset seeked
|
|
221
|
+
seeking select show stalled submit suspend timeupdate toggle
|
|
222
|
+
volumechange waiting cut copy paste blur error focus load resize
|
|
223
|
+
scroll].map { |n| "name()=\"on#{n}\"" }.join(" or ") +
|
|
225
224
|
# or whose parent is body or frameset
|
|
226
|
-
|
|
225
|
+
" or (parent::body or parent::frameset)" +
|
|
227
226
|
# and
|
|
228
|
-
|
|
227
|
+
" and (" +
|
|
229
228
|
# whose names are any of
|
|
230
229
|
%w[afterprint beforeprint beforeunload hashchange languagechange
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
message offline online pagehide pageshow popstate
|
|
231
|
+
rejectionhandled storage unhandledrejection
|
|
232
|
+
unload].map { |n| "name()=\"on#{n}\"" }.join(" or ") +
|
|
233
|
+
")" \
|
|
234
|
+
"]"
|
|
236
235
|
).freeze
|
|
237
236
|
# rubocop:enable Style/StringConcatenation
|
|
238
237
|
private_constant :EVENT_HANDLERS_XPATH
|
|
239
238
|
|
|
240
239
|
def uglify(content, options)
|
|
241
240
|
js = Uglifier.compile(content, options)
|
|
242
|
-
js.chomp!(
|
|
241
|
+
js.chomp!(";")
|
|
243
242
|
js
|
|
244
243
|
end
|
|
245
244
|
|
|
@@ -252,9 +251,9 @@ module Squoosh
|
|
|
252
251
|
|
|
253
252
|
def compress_javascript(doc)
|
|
254
253
|
# Compress script elements.
|
|
255
|
-
doc.xpath(
|
|
256
|
-
type = node[
|
|
257
|
-
next unless type.nil? || type ==
|
|
254
|
+
doc.xpath("//script[not(ancestor::math or ancestor::svg)]").each do |node|
|
|
255
|
+
type = node["type"]&.downcase
|
|
256
|
+
next unless type.nil? || type == "text/javascript"
|
|
258
257
|
|
|
259
258
|
node.content = compress_script(node.content)
|
|
260
259
|
end
|
|
@@ -266,14 +265,14 @@ module Squoosh
|
|
|
266
265
|
|
|
267
266
|
def compress_css(doc)
|
|
268
267
|
# Compress style elements.
|
|
269
|
-
doc.xpath(
|
|
270
|
-
type = node[
|
|
271
|
-
next unless type.nil? || type ==
|
|
268
|
+
doc.xpath("//style[not(ancestor::math or ancestor::svg)]").each do |node|
|
|
269
|
+
type = node["type"]&.downcase
|
|
270
|
+
next unless type.nil? || type == "text/css" || type.empty?
|
|
272
271
|
|
|
273
272
|
node.content = minify_css node.content
|
|
274
273
|
end
|
|
275
274
|
# Compress style attributes
|
|
276
|
-
doc.xpath(
|
|
275
|
+
doc.xpath("//@style[not(ancestor::math or ancestor::svg)]").each do |node|
|
|
277
276
|
elm_type = node.parent.name
|
|
278
277
|
css = "#{elm_type}{#{node.content}}"
|
|
279
278
|
node.content = minify_css(css)[elm_type.length + 1..-2]
|
|
@@ -287,15 +286,15 @@ module Squoosh
|
|
|
287
286
|
node.unlink
|
|
288
287
|
else
|
|
289
288
|
content = node.content
|
|
290
|
-
content.gsub!(/[ \t\n\r\f]+/,
|
|
289
|
+
content.gsub!(/[ \t\n\r\f]+/, " ")
|
|
291
290
|
content.lstrip! if trim_left? node
|
|
292
291
|
content.rstrip! if trim_right? node
|
|
293
292
|
node.content = content
|
|
294
293
|
end
|
|
295
294
|
elsif node.element? &&
|
|
296
|
-
|
|
295
|
+
(node.name == "pre" || node.name == "textarea")
|
|
297
296
|
# Leave the contents of these nodes alone.
|
|
298
|
-
elsif normal_element?(node) || node.name ==
|
|
297
|
+
elsif normal_element?(node) || node.name == "title"
|
|
299
298
|
# Compress spaces in normal elements and title.
|
|
300
299
|
node.children.each { |c| compress_spaces c }
|
|
301
300
|
end
|
|
@@ -317,18 +316,18 @@ module Squoosh
|
|
|
317
316
|
prev_elm = node.previous_element
|
|
318
317
|
return !phrasing_content?(node.parent) if prev_elm.nil?
|
|
319
318
|
|
|
320
|
-
prev_elm.name ==
|
|
319
|
+
prev_elm.name == "br"
|
|
321
320
|
end
|
|
322
321
|
|
|
323
322
|
def trim_right?(node)
|
|
324
323
|
next_elm = node.next_element
|
|
325
324
|
return !phrasing_content?(node.parent) if next_elm.nil?
|
|
326
325
|
|
|
327
|
-
next_elm.name ==
|
|
326
|
+
next_elm.name == "br"
|
|
328
327
|
end
|
|
329
328
|
|
|
330
329
|
def stringify_node(node)
|
|
331
|
-
return node.to_html(encoding:
|
|
330
|
+
return node.to_html(encoding: "UTF-8") unless node.element?
|
|
332
331
|
|
|
333
332
|
output = StringIO.new
|
|
334
333
|
# Add start tag. 8.1.2.1
|
|
@@ -345,10 +344,10 @@ module Squoosh
|
|
|
345
344
|
# some cases.
|
|
346
345
|
# value = (attr.value || '')
|
|
347
346
|
# value.gsub!(/&([a-zA-Z0-9]+;|#[0-9]+|#[xX][a-fA-F0-9]+)/, '&\1')
|
|
348
|
-
value = (attr.value ||
|
|
347
|
+
value = (attr.value || "").gsub("&", "&")
|
|
349
348
|
if value.empty?
|
|
350
349
|
output << " #{name}"
|
|
351
|
-
elsif
|
|
350
|
+
elsif !/[\t\n\f\r "'`=<>]/.match?(value)
|
|
352
351
|
last_attr_unquoted = true
|
|
353
352
|
output << " #{name}=#{value}"
|
|
354
353
|
elsif !value.include?('"')
|
|
@@ -357,22 +356,22 @@ module Squoosh
|
|
|
357
356
|
output << " #{name}='#{value}'"
|
|
358
357
|
else
|
|
359
358
|
# Contains both ' and ".
|
|
360
|
-
output << " #{name}=\"#{value.gsub('"',
|
|
359
|
+
output << " #{name}=\"#{value.gsub('"', """)}\""
|
|
361
360
|
end
|
|
362
361
|
end
|
|
363
362
|
|
|
364
363
|
# Close start tag.
|
|
365
364
|
if self_closing? node
|
|
366
|
-
output <<
|
|
367
|
-
output <<
|
|
365
|
+
output << " " if last_attr_unquoted
|
|
366
|
+
output << "/"
|
|
368
367
|
end
|
|
369
|
-
output <<
|
|
368
|
+
output << ">"
|
|
370
369
|
end
|
|
371
370
|
|
|
372
371
|
# If pre or textarea start with a newline, double it because the HTML
|
|
373
372
|
# parser strips leading newlines.
|
|
374
|
-
if (node.name ==
|
|
375
|
-
|
|
373
|
+
if (node.name == "pre" || node.name == "textarea") &&
|
|
374
|
+
!node.children.empty?
|
|
376
375
|
first_child = node.children[0]
|
|
377
376
|
if first_child.text? && first_child.content.start_with?("\n")
|
|
378
377
|
output << "\n"
|
|
@@ -387,9 +386,9 @@ module Squoosh
|
|
|
387
386
|
output.string
|
|
388
387
|
end
|
|
389
388
|
|
|
390
|
-
XML_NAMESPACE =
|
|
391
|
-
XMLNS_NAMESPACE =
|
|
392
|
-
XLINK_NAMESPACE =
|
|
389
|
+
XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
|
|
390
|
+
XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"
|
|
391
|
+
XLINK_NAMESPACE = "http://www.w3.org/1999/xlink"
|
|
393
392
|
private_constant :XML_NAMESPACE, :XMLNS_NAMESPACE, :XLINK_NAMESPACE
|
|
394
393
|
|
|
395
394
|
def qualified_attribute_name(attr)
|
|
@@ -399,15 +398,15 @@ module Squoosh
|
|
|
399
398
|
uri = ns.href
|
|
400
399
|
if uri == XML_NAMESPACE
|
|
401
400
|
"xml:#{attr.name}"
|
|
402
|
-
elsif uri == XMLNS_NAMESPACE && attr.name ==
|
|
403
|
-
|
|
401
|
+
elsif uri == XMLNS_NAMESPACE && attr.name == "xmlns"
|
|
402
|
+
"xmlns"
|
|
404
403
|
elsif uri == XMLNS_NAMESPACE
|
|
405
404
|
"xmlns:#{attr.name}"
|
|
406
405
|
elsif uri == XLINK_NAMESPACE
|
|
407
406
|
"xlink:#{attr.name}"
|
|
408
407
|
else
|
|
409
408
|
# :nocov:
|
|
410
|
-
raise
|
|
409
|
+
raise "Unreachable!"
|
|
411
410
|
# :nocov:
|
|
412
411
|
end
|
|
413
412
|
end
|
|
@@ -472,17 +471,17 @@ module Squoosh
|
|
|
472
471
|
return false unless node.attributes.empty?
|
|
473
472
|
|
|
474
473
|
case node.name
|
|
475
|
-
when
|
|
474
|
+
when "html"
|
|
476
475
|
# An html element's start tag may be omitted if the first thing inside
|
|
477
476
|
# the html element is not a comment.
|
|
478
477
|
return node.children.empty? || !node.children[0].comment?
|
|
479
478
|
|
|
480
|
-
when
|
|
479
|
+
when "head"
|
|
481
480
|
# A head element's start tag may be omitted if the element is empty,
|
|
482
481
|
# or if the first thing inside the head element is an element.
|
|
483
482
|
return node.children.empty? || node.children[0].element?
|
|
484
483
|
|
|
485
|
-
when
|
|
484
|
+
when "body"
|
|
486
485
|
# A body element's start tag may be omitted if the element is empty,
|
|
487
486
|
# or if the first thing inside the body element is not a space
|
|
488
487
|
# character or a comment, except if the first thing inside the body
|
|
@@ -490,32 +489,32 @@ module Squoosh
|
|
|
490
489
|
return true if node.children.empty?
|
|
491
490
|
|
|
492
491
|
c = node.children[0]
|
|
493
|
-
return !c.content.start_with?(
|
|
492
|
+
return !c.content.start_with?(" ") if c.text?
|
|
494
493
|
return false if c.comment?
|
|
495
494
|
|
|
496
495
|
return !c.element? ||
|
|
497
|
-
|
|
496
|
+
!%w[meta link script style template].include?(c.name)
|
|
498
497
|
|
|
499
|
-
when
|
|
498
|
+
when "colgroup"
|
|
500
499
|
# A colgroup element's start tag may be omitted if the first thing
|
|
501
500
|
# inside the colgroup element is a col element, and if the element is
|
|
502
501
|
# not immediately preceded by another colgroup element whose end tag
|
|
503
502
|
# has been omitted. (It can't be omitted if the element is empty.)
|
|
504
503
|
child = first_child_content_node(node)
|
|
505
|
-
return false if child.nil? || !child.element? || child.name !=
|
|
504
|
+
return false if child.nil? || !child.element? || child.name != "col"
|
|
506
505
|
|
|
507
506
|
prev_node = previous_sibling_content_node(node)
|
|
508
507
|
return !(prev_node&.element? &&
|
|
509
|
-
prev_node.name ==
|
|
508
|
+
prev_node.name == "colgroup" &&
|
|
510
509
|
omit_end_tag?(prev_node))
|
|
511
510
|
|
|
512
|
-
when
|
|
511
|
+
when "tbody"
|
|
513
512
|
# A tbody element's start tag may be omitted if the first thing inside
|
|
514
513
|
# the tbody element is a tr element, and if the element is not
|
|
515
514
|
# immediately preceded by a tbody, thead, or tfoot element whose end
|
|
516
515
|
# tag has been omitted. (It can't be omitted if the element is empty.)
|
|
517
516
|
child = first_child_content_node(node)
|
|
518
|
-
return false if child.nil? || !child.element? || child.name !=
|
|
517
|
+
return false if child.nil? || !child.element? || child.name != "tr"
|
|
519
518
|
|
|
520
519
|
prev_node = previous_sibling_content_node(node)
|
|
521
520
|
return !(prev_node&.element? &&
|
|
@@ -528,45 +527,44 @@ module Squoosh
|
|
|
528
527
|
def omit_end_tag?(node)
|
|
529
528
|
return true if void_element?(node) || self_closing?(node)
|
|
530
529
|
return false unless @options[:omit_tags]
|
|
531
|
-
return false if node.parent.name == 'noscript'
|
|
532
530
|
|
|
533
531
|
next_node = node.next_sibling
|
|
534
532
|
case node.name
|
|
535
|
-
when
|
|
533
|
+
when "html"
|
|
536
534
|
# An html element's end tag may be omitted if the html element is not
|
|
537
535
|
# immediately followed by a comment.
|
|
538
536
|
return next_node.nil? || !next_node.comment?
|
|
539
537
|
|
|
540
|
-
when
|
|
538
|
+
when "head"
|
|
541
539
|
# A head element's end tag may be omitted if the head element is not
|
|
542
540
|
# immediately followed by a space character or a comment.
|
|
543
541
|
return next_node.nil? ||
|
|
544
|
-
|
|
545
|
-
|
|
542
|
+
(next_node.text? && !next_node.content.start_with?(" ")) ||
|
|
543
|
+
!next_node.comment?
|
|
546
544
|
|
|
547
|
-
when
|
|
545
|
+
when "body"
|
|
548
546
|
# A body element's end tag may be omitted if the body element is not
|
|
549
547
|
# immediately followed by a comment.
|
|
550
548
|
return next_node.nil? || !next_node.comment?
|
|
551
549
|
|
|
552
|
-
when
|
|
550
|
+
when "li"
|
|
553
551
|
# An li element's end tag may be omitted if the li element is
|
|
554
552
|
# immediately followed by another li element or if there is no more
|
|
555
553
|
# content in the parent element.
|
|
556
|
-
return next_sibling_is_nil_or_one_of?(node, [
|
|
554
|
+
return next_sibling_is_nil_or_one_of?(node, ["li"])
|
|
557
555
|
|
|
558
|
-
when
|
|
556
|
+
when "dt"
|
|
559
557
|
# A dt element's end tag may be omitted if the dt element is immediately
|
|
560
558
|
# followed by another dt element or a dd element.
|
|
561
559
|
return next_sibling_is_one_of?(node, %w[dt dd])
|
|
562
560
|
|
|
563
|
-
when
|
|
561
|
+
when "dd"
|
|
564
562
|
# A dd element's end tag may be omitted if the dd element is immediately
|
|
565
563
|
# followed by another dd element or a dt element, or if there is no more
|
|
566
564
|
# content in the parent element.
|
|
567
565
|
return next_sibling_is_nil_or_one_of?(node, %w[dt dd])
|
|
568
566
|
|
|
569
|
-
when
|
|
567
|
+
when "p"
|
|
570
568
|
# A p element's end tag can be omitted if the p element is immediately
|
|
571
569
|
# followed by an address, article, aside, blockquote, details, div,
|
|
572
570
|
# dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5,
|
|
@@ -583,12 +581,11 @@ module Squoosh
|
|
|
583
581
|
ol p pre section table ul
|
|
584
582
|
]
|
|
585
583
|
)
|
|
584
|
+
return false if parent_contains_more_content?(node)
|
|
586
585
|
return false if foreign_element?(node.parent)
|
|
586
|
+
return !%(a audio del ins map noscript video).include?(node.parent.name)
|
|
587
587
|
|
|
588
|
-
|
|
589
|
-
!%(a audio del ins map noscript video).include?(node.parent.name)
|
|
590
|
-
|
|
591
|
-
when 'rb', 'rt', 'rp'
|
|
588
|
+
when "rb", "rt", "rp"
|
|
592
589
|
# An rb element's end tag may be omitted if the rb element is
|
|
593
590
|
# immediately followed by an rb, rt, rtc or rp element, or if there is
|
|
594
591
|
# no more content in the parent element.
|
|
@@ -602,56 +599,56 @@ module Squoosh
|
|
|
602
599
|
# no more content in the parent element.
|
|
603
600
|
return next_sibling_is_nil_or_one_of?(node, %w[rb rt rtc rp])
|
|
604
601
|
|
|
605
|
-
when
|
|
602
|
+
when "rtc"
|
|
606
603
|
# An rtc element's end tag may be omitted if the rtc element is
|
|
607
604
|
# immediately followed by an rb, rtc or rp element, or if there is no
|
|
608
605
|
# more content in the parent element.
|
|
609
606
|
return next_sibling_is_nil_or_one_of?(node, %w[rb rtc rp])
|
|
610
607
|
|
|
611
|
-
when
|
|
608
|
+
when "optgroup"
|
|
612
609
|
# An optgroup element's end tag may be omitted if the optgroup element
|
|
613
610
|
# is immediately followed by another optgroup element, or if there is
|
|
614
611
|
# no more content in the parent element.
|
|
615
|
-
return next_sibling_is_nil_or_one_of?(node, [
|
|
612
|
+
return next_sibling_is_nil_or_one_of?(node, ["optgroup"])
|
|
616
613
|
|
|
617
|
-
when
|
|
614
|
+
when "option"
|
|
618
615
|
# An option element's end tag may be omitted if the option element is
|
|
619
616
|
# immediately followed by another option element, or if it is
|
|
620
617
|
# immediately followed by an optgroup element, or if there is no more
|
|
621
618
|
# content in the parent element.
|
|
622
619
|
return next_sibling_is_nil_or_one_of?(node, %w[option optgroup])
|
|
623
620
|
|
|
624
|
-
when
|
|
621
|
+
when "colgroup"
|
|
625
622
|
# A colgroup element's end tag may be omitted if the colgroup element is
|
|
626
623
|
# not immediately followed by a space character or a comment.
|
|
627
624
|
return true if next_node.nil?
|
|
628
|
-
return !next_node.content.start_with?(
|
|
625
|
+
return !next_node.content.start_with?(" ") if next_node.text?
|
|
629
626
|
|
|
630
627
|
return !next_node.comment?
|
|
631
628
|
|
|
632
|
-
when
|
|
629
|
+
when "thead"
|
|
633
630
|
# A thead element's end tag may be omitted if the thead element is
|
|
634
631
|
# immediately followed by a tbody or tfoot element.
|
|
635
632
|
return next_sibling_is_one_of?(node, %w[tbody tfoot])
|
|
636
633
|
|
|
637
|
-
when
|
|
634
|
+
when "tbody"
|
|
638
635
|
# A tbody element's end tag may be omitted if the tbody element is
|
|
639
636
|
# immediately followed by a tbody or tfoot element, or if there is no
|
|
640
637
|
# more content in the parent element.
|
|
641
638
|
return next_sibling_is_nil_or_one_of?(node, %w[tbody tfoot])
|
|
642
639
|
|
|
643
|
-
when
|
|
640
|
+
when "tfoot"
|
|
644
641
|
# A tfoot element's end tag can be omitted if there is no more content
|
|
645
642
|
# in the parent element.
|
|
646
643
|
return !parent_contains_more_content?(node)
|
|
647
644
|
|
|
648
|
-
when
|
|
645
|
+
when "tr"
|
|
649
646
|
# A tr element's end tag may be omitted if the tr element is immediately
|
|
650
647
|
# followed by another tr element, or if there is no more content in the
|
|
651
648
|
# parent element.
|
|
652
|
-
return next_sibling_is_nil_or_one_of?(node, [
|
|
649
|
+
return next_sibling_is_nil_or_one_of?(node, ["tr"])
|
|
653
650
|
|
|
654
|
-
when
|
|
651
|
+
when "td", "th"
|
|
655
652
|
# A td element's end tag may be omitted if the td element is immediately
|
|
656
653
|
# followed by a td or th element, or if there is no more content in the
|
|
657
654
|
# parent element.
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: squoosh
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Checkoway
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -25,7 +24,21 @@ dependencies:
|
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: minitest
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: minitest-proveit
|
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
|
30
43
|
requirements:
|
|
31
44
|
- - ">="
|
|
@@ -39,7 +52,21 @@ dependencies:
|
|
|
39
52
|
- !ruby/object:Gem::Version
|
|
40
53
|
version: '0'
|
|
41
54
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
55
|
+
name: minitest-reporters
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rake
|
|
43
70
|
requirement: !ruby/object:Gem::Requirement
|
|
44
71
|
requirements:
|
|
45
72
|
- - ">="
|
|
@@ -67,7 +94,7 @@ dependencies:
|
|
|
67
94
|
- !ruby/object:Gem::Version
|
|
68
95
|
version: '0'
|
|
69
96
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rubocop-
|
|
97
|
+
name: rubocop-minitest
|
|
71
98
|
requirement: !ruby/object:Gem::Requirement
|
|
72
99
|
requirements:
|
|
73
100
|
- - ">="
|
|
@@ -81,7 +108,7 @@ dependencies:
|
|
|
81
108
|
- !ruby/object:Gem::Version
|
|
82
109
|
version: '0'
|
|
83
110
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rubocop-
|
|
111
|
+
name: rubocop-rake
|
|
85
112
|
requirement: !ruby/object:Gem::Requirement
|
|
86
113
|
requirements:
|
|
87
114
|
- - ">="
|
|
@@ -122,6 +149,20 @@ dependencies:
|
|
|
122
149
|
- - ">="
|
|
123
150
|
- !ruby/object:Gem::Version
|
|
124
151
|
version: '0'
|
|
152
|
+
- !ruby/object:Gem::Dependency
|
|
153
|
+
name: standard
|
|
154
|
+
requirement: !ruby/object:Gem::Requirement
|
|
155
|
+
requirements:
|
|
156
|
+
- - ">="
|
|
157
|
+
- !ruby/object:Gem::Version
|
|
158
|
+
version: '0'
|
|
159
|
+
type: :development
|
|
160
|
+
prerelease: false
|
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
125
166
|
- !ruby/object:Gem::Dependency
|
|
126
167
|
name: yard
|
|
127
168
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,14 +183,14 @@ dependencies:
|
|
|
142
183
|
requirements:
|
|
143
184
|
- - "~>"
|
|
144
185
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '1.
|
|
186
|
+
version: '1.16'
|
|
146
187
|
type: :runtime
|
|
147
188
|
prerelease: false
|
|
148
189
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
190
|
requirements:
|
|
150
191
|
- - "~>"
|
|
151
192
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '1.
|
|
193
|
+
version: '1.16'
|
|
153
194
|
- !ruby/object:Gem::Dependency
|
|
154
195
|
name: sassc
|
|
155
196
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,7 +219,6 @@ dependencies:
|
|
|
178
219
|
- - "~>"
|
|
179
220
|
- !ruby/object:Gem::Version
|
|
180
221
|
version: '4.1'
|
|
181
|
-
description:
|
|
182
222
|
email:
|
|
183
223
|
- s@pahtak.org
|
|
184
224
|
executables: []
|
|
@@ -198,7 +238,6 @@ metadata:
|
|
|
198
238
|
homepage_uri: https://github.com/stevecheckoway/squoosh
|
|
199
239
|
source_code_uri: https://github.com/stevecheckoway/squoosh
|
|
200
240
|
rubygems_mfa_required: 'true'
|
|
201
|
-
post_install_message:
|
|
202
241
|
rdoc_options: []
|
|
203
242
|
require_paths:
|
|
204
243
|
- lib
|
|
@@ -206,18 +245,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
206
245
|
requirements:
|
|
207
246
|
- - ">="
|
|
208
247
|
- !ruby/object:Gem::Version
|
|
209
|
-
version: '
|
|
248
|
+
version: '3.1'
|
|
210
249
|
- - "<"
|
|
211
250
|
- !ruby/object:Gem::Version
|
|
212
|
-
version: '
|
|
251
|
+
version: '5.0'
|
|
213
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
253
|
requirements:
|
|
215
254
|
- - ">="
|
|
216
255
|
- !ruby/object:Gem::Version
|
|
217
256
|
version: '0'
|
|
218
257
|
requirements: []
|
|
219
|
-
rubygems_version: 3.
|
|
220
|
-
signing_key:
|
|
258
|
+
rubygems_version: 3.7.2
|
|
221
259
|
specification_version: 4
|
|
222
260
|
summary: Minify HTML/CSS/JavaScript files.
|
|
223
261
|
test_files: []
|