Skip to content

Commit

Permalink
change default ie8 support to false
Browse files Browse the repository at this point in the history
  • Loading branch information
ahorek committed Jul 11, 2018
1 parent 9f4ad0b commit 8d95c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/uglifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Error < StandardError; end
:define => {}, # Define values for symbol replacement
:keep_fnames => false, # Generate code safe for the poor souls relying on Function.prototype.name at run-time. Sets both compress and mangle keep_fanems to true.
:toplevel => false,
:ie8 => true, # Generate safe code for IE8
:ie8 => false, # Generate safe code for IE8
:source_map => false, # Generate source map
:harmony => false # Enable ES6/Harmony mode (experimental). Disabling mangling and compressing is recommended with Harmony mode.
}
Expand Down
10 changes: 7 additions & 3 deletions spec/uglifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,12 @@
describe "ie8 option" do
let(:code) { "function something() { return g.switch; }" }

it "defaults to IE8-safe output" do
expect(Uglifier.compile(code)).to match("\"switch\"")
it "defaults to non-IE8-safe output" do
expect(Uglifier.compile(code)).to match(/g\.switch/)
end

it "handles IE8-safe output" do
expect(Uglifier.compile(code, :ie8 => true)).to match("\"switch\"")
end

it "forwards ie8 option to UglifyJS" do
Expand Down Expand Up @@ -324,7 +328,7 @@

it "quotes unsafe keys by default" do
code = 'var code = {"class": "", "\u200c":"A"}'
expect(Uglifier.compile(code)).to include('"class"')
expect(Uglifier.compile(code)).to include('class')
expect(Uglifier.compile(code)).to include('"\u200c"')

uglifier = Uglifier.new(:output => { :ascii_only => false, :quote_keys => false })
Expand Down

0 comments on commit 8d95c4a

Please sign in to comment.