Skip to content

Commit

Permalink
HTML Escaping in JS
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny committed May 20, 2011
1 parent 5823e34 commit 155cfad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions public/script.js
Expand Up @@ -105,14 +105,14 @@ $(function() {
album = obj.album || '',
title = obj.title || ''

$('#title' ).html(title)
$('#artist').html(artist)
$('#album' ).html(album)
$('#title' ).text(title)
$('#artist').text(artist)
$('#album' ).text(album)

if (!title && !title) {
$('title').html('So nice')
$('title').text('So nice')
} else {
$('title').html(artist + (artist && title ? ' – ' : '') + title)
$('title').text(artist + (artist && title ? ' ' : '') + title)
}

if (artistChange || songChange)
Expand Down
2 changes: 1 addition & 1 deletion sonice.rb
Expand Up @@ -56,7 +56,7 @@ def artist_image(artist)
@album = $player.album
if request.xhr?
content_type :json
{ :title => h(@title), :artist => h(@artist), :album => h(@album) }.to_json
{ :title => @title, :artist => @artist, :album => @album }.to_json
else
@image_uri = artist_image(@artist)
haml :index
Expand Down

0 comments on commit 155cfad

Please sign in to comment.