Explorar o código

Domite >> cutUpTo:

Herbert Vojčík %!s(int64=9) %!d(string=hai) anos
pai
achega
0b52380bb7
Modificáronse 2 ficheiros con 20 adicións e 1 borrados
  1. 0 1
      src/DOMite.js
  2. 20 0
      src/DOMite.st

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 1
src/DOMite.js


+ 20 - 0
src/DOMite.st

@@ -21,11 +21,15 @@ Creation API:
 CSS selector API:
 
  - `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:
 
  - `aDomite << obj` inserts obj at the insertion point.
  - `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:
 
@@ -112,6 +116,22 @@ asJQuery
 
 !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
 <
 	var element = self['@element'], child;

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio