Skip to content

Commit

Permalink
Image.src returns emptry string not undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
client9 committed Mar 25, 2010
1 parent d64ef8b commit 4fa4d74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/html/img.js
Expand Up @@ -38,7 +38,7 @@ __extend__(HTMLImageElement.prototype, {
this.setAttribute('name', value);
},
get src(){
return this.getAttribute('src');
return this.getAttribute('src') || '';
},
set src(value){
var event;
Expand Down
1 change: 1 addition & 0 deletions test/specs/html/spec.js
Expand Up @@ -352,6 +352,7 @@ test('HTMLDocument.createElement(script)', function(){
test("Image", function() {
var x = new Image();
equals(x, '[object HTMLImageElement]', 'toString');
equals(x.src, '', 'new image has src as empty string');

// determined experimentally
equals(x.width, 0, 'default width is 0');
Expand Down

0 comments on commit 4fa4d74

Please sign in to comment.