Permalink
Browse files

Merge pull request #2187 from arian/fix-2182-erase-html

Fixes #2182 - Element.erase('html') should set the innerHTML to an empty string
  • Loading branch information...
2 parents 99dd290 + 4adb41a commit 4086f20c788eb1531ad8db04c811a516d965970b @ibolmo ibolmo committed Jan 7, 2012
Showing with 9 additions and 0 deletions.
  1. +1 −0 Source/Element/Element.js
  2. +8 −0 Specs/1.4client/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>*/
@@ -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 4086f20

Please sign in to comment.