Skip to content

Commit

Permalink
Merge pull request #64 from adidahiya/options-content-function
Browse files Browse the repository at this point in the history
(bugfix) clear content element when setting from options.content function that returns an Element
  • Loading branch information
b-ash committed Apr 21, 2015
2 parents 41e3e66 + cf741cd commit 0531e75
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions coffee/drop.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ createContext = (options={}) ->
if typeof contentElementOrHTML is 'string'
@content.innerHTML = contentElementOrHTML
else if typeof contentElementOrHTML is 'object'
@content.innerHTML = ""
@content.appendChild(contentElementOrHTML)
else
throw new Error 'Drop Error: Content function should return a string or HTMLElement.'
Expand Down
1 change: 1 addition & 0 deletions drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,7 @@ return this.Tether;
if (typeof contentElementOrHTML === 'string') {
return _this.content.innerHTML = contentElementOrHTML;
} else if (typeof contentElementOrHTML === 'object') {
_this.content.innerHTML = "";
return _this.content.appendChild(contentElementOrHTML);
} else {
throw new Error('Drop Error: Content function should return a string or HTMLElement.');
Expand Down
Loading

0 comments on commit 0531e75

Please sign in to comment.