Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2182 - Element.erase('html') should set the innerHTML to an empty string #2187

Merged
merged 1 commit into from
Jan 7, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/Element/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ Element.Properties.html = (function(){
var html = {
set: function(html){
if (typeOf(html) == 'array') html = html.join('');
else if (!html) html = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check for html == undefined reason being false, 0, and any toValue that returns falsy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, yeah, probably if (html == null) html = ''; would be better...


var wrap = (!tableTest && translations[this.get('tag')]);
/*<ltIE9>*/
Expand Down
8 changes: 8 additions & 0 deletions Specs/1.4client/Element/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down