|
@@ -21,11 +21,15 @@ Creation API:
|
|
CSS selector API:
|
|
CSS selector API:
|
|
|
|
|
|
- `Domite at: aSelector` wraps an element found by `document.querySelector(aSelector)`.
|
|
- `Domite at: aSelector` wraps an element found by `document.querySelector(aSelector)`.
|
|
|
|
+ - `aDomite at: aSelector` wraps an element found by `element.querySelector(aSelector)`.
|
|
|
|
+ - `Domite allAt: aSelector` return collection of wrapped results of `document.querySelectorAll(aSelector)`.
|
|
|
|
+ - `aDomite allAt: aSelector` return collection of wrapped results of `element.querySelectorAll(aSelector)`.
|
|
|
|
|
|
Manipulation API:
|
|
Manipulation API:
|
|
|
|
|
|
- `aDomite << obj` inserts obj at the insertion point.
|
|
- `aDomite << obj` inserts obj at the insertion point.
|
|
- `aDomite resetContents` deletes contents of the wrapped element.
|
|
- `aDomite resetContents` deletes contents of the wrapped element.
|
|
|
|
+ - `aDomite cutUpTo: anotherDomite` removes contents between the two cursors (or up to the end of the receiver) and returns it collected in a wrapped DocumentFragment (IOW, you can `anotherPlace << theResult` to move the contents in the specified range).
|
|
|
|
|
|
Cursor moving API:
|
|
Cursor moving API:
|
|
|
|
|
|
@@ -112,6 +116,22 @@ asJQuery
|
|
|
|
|
|
!Domite methodsFor: 'deletion'!
|
|
!Domite methodsFor: 'deletion'!
|
|
|
|
|
|
|
|
+cutUpTo: aDomite
|
|
|
|
+<
|
|
|
|
+ var result = document.createDocumentFragment(),
|
|
|
|
+ start = self['@reference'],
|
|
|
|
+ end = aDomite['@reference'],
|
|
|
|
+ tmp;
|
|
|
|
+ while (start && start !!= end) {
|
|
|
|
+ tmp = start;
|
|
|
|
+ start = start.nextSibling;
|
|
|
|
+ result.appendChild(tmp);
|
|
|
|
+ }
|
|
|
|
+ self['@reference'] = start;
|
|
|
|
+ return self._class()._fromElement_(result);
|
|
|
|
+>
|
|
|
|
+!
|
|
|
|
+
|
|
resetContents
|
|
resetContents
|
|
<
|
|
<
|
|
var element = self['@element'], child;
|
|
var element = self['@element'], child;
|