Skip to content

Commit

Permalink
Merge pull request rstacruz#21 from benschwarz/master
Browse files Browse the repository at this point in the history
Removed un-required attributes from <link> and <script> tags
  • Loading branch information
rstacruz committed Sep 22, 2011
2 parents 0afb296 + e3346ee commit 1e934a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/sinatra/assetpack/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def css?() @type == :css; end
private
def link_tag(file, options={})
if js?
"<script type='text/javascript' src='#{e file}'#{kv options}></script>"
"<script src='#{e file}'#{kv options}></script>"
elsif css?
"<link rel='stylesheet' type='text/css' href='#{e file}'#{kv options} />"
"<link rel='stylesheet' href='#{e file}'#{kv options} />"
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/unit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ class AppTest < UnitTest

test "helpers" do
get '/index.html'
assert body =~ /<script type='text\/javascript' src='\/js\/hello.[0-9]+.js'><\/script>/
assert body =~ /<script type='text\/javascript' src='\/js\/hi.[0-9]+.js'><\/script>/
assert body =~ /<script src='\/js\/hello.[0-9]+.js'><\/script>/
assert body =~ /<script src='\/js\/hi.[0-9]+.js'><\/script>/
end

test "helpers in production (compressed html thingie)" do
app.expects(:production?).returns(true)
get '/index.html'
assert body =~ /<script type='text\/javascript' src='\/js\/app.[0-9]+.js'><\/script>/
assert body =~ /<script src='\/js\/app.[0-9]+.js'><\/script>/
end

test "compressed js" do
Expand All @@ -96,6 +96,6 @@ class AppTest < UnitTest

test "helpers css" do
get '/helpers/css'
assert body =~ %r{link rel='stylesheet' type='text/css' href='/css/screen.[0-9]+.css' media='screen'}
assert body =~ %r{link rel='stylesheet' href='/css/screen.[0-9]+.css' media='screen'}
end
end

0 comments on commit 1e934a7

Please sign in to comment.