Skip to content

Commit

Permalink
more liverange docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreensp committed Apr 26, 2012
1 parent 55dd0eb commit 02469a8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/liveui/liverange.js
Expand Up @@ -485,7 +485,9 @@ Meteor.ui = Meteor.ui || {};
ends[i]._end = targetNode;
};


// Inserts a DocumentFragment immediately before this range.
// The new nodes are outside this range but inside all
// enclosing ranges.
Meteor.ui._LiveRange.prototype.insert_before = function(frag) {
var frag_start = frag.firstChild;

Expand All @@ -503,6 +505,9 @@ Meteor.ui = Meteor.ui || {};
this._start_idx));
};

// Inserts a DocumentFragment immediately after this range.
// The new nodes are outside this range but inside all
// enclosing ranges.
Meteor.ui._LiveRange.prototype.insert_after = function(frag) {
var frag_end = frag.lastChild;

Expand All @@ -520,6 +525,15 @@ Meteor.ui = Meteor.ui || {};
this._end_idx + 1));
};

// Extracts this range and its contents from the DOM and
// puts it into a DocumentFragment, which is returned.
// All nodes and ranges outside this range are properly
// preserved.
//
// Because liveranges must contain at least one node,
// it is illegal to perform `extract` if the immediately
// enclosing range would become empty. If this precondition
// is violated, no action is taken and null is returned.
Meteor.ui._LiveRange.prototype.extract = function() {
if (this._start_idx > 0 &&
this._start[this.tag][0][this._start_idx - 1]._end === this._end) {
Expand Down

0 comments on commit 02469a8

Please sign in to comment.