Skip to content
Browse files

Fixes #2182 - Element.erase('html') should set the innerHTML to an em…

…pty string.

Element.properties.html.erase was aliased to Element.properties.html.set, but when calling it without any arguments this resulted in .set(undefined).
  • Loading branch information...
1 parent 1959959 commit 4adb41afe81757c6a49e6797f203a661285359a3 @arian arian committed Dec 24, 2011
Showing with 9 additions and 0 deletions.
  1. +1 −0 Source/Element/Element.js
  2. +8 −0 Specs/1.4client/Element/Element.js
View
1 Source/Element/Element.js
@@ -920,6 +920,7 @@ Element.Properties.html = (function(){
var html = {
set: function(html){
if (typeOf(html) == 'array') html = html.join('');
+ else if (!html) html = '';
var wrap = (!tableTest && translations[this.get('tag')]);
/*<ltIE9>*/
View
8 Specs/1.4client/Element/Element.js
@@ -162,6 +162,14 @@ describe('Element', function(){
});
+ describe("Element.erase('html')", function(){
+
+ it('should empty the html inside an element', function(){
+ expect(new Element('div', {html: '<p>foo bar</p>'}).erase('html').innerHTML).toEqual('');
+ });
+
+ });
+
describe('Element.clone', function(){
it('should not crash IE for multiple clones', function(){

0 comments on commit 4adb41a

Please sign in to comment.
Something went wrong with that request. Please try again.