From 4fa4d74dfb849e2a82d792678444c1edb43e6d7e Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 25 Mar 2010 00:56:06 -0400 Subject: [PATCH] Image.src returns emptry string not undefined --- src/html/img.js | 2 +- test/specs/html/spec.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/html/img.js b/src/html/img.js index cb9d7a73..d790c2f7 100644 --- a/src/html/img.js +++ b/src/html/img.js @@ -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; diff --git a/test/specs/html/spec.js b/test/specs/html/spec.js index 46f7c55c..91e8e073 100644 --- a/test/specs/html/spec.js +++ b/test/specs/html/spec.js @@ -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');