Skip to content

Commit 40ac463

Browse files
committed
release v0.4.1
1 parent 72a8301 commit 40ac463

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ el.replaceWith('<div id="replaced">Previous element replaced</div>');
221221
### Traversing
222222
With traversal methods, you can find adjacent or parent elements accordingly. Almost all traversal methods returns a `uxr` object. You can return the previous `uxr` by chaining `end()`
223223
224-
```javascript
224+
``` js
225225

226226
let el = uxr('li');
227227

dist/uxr.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* uxr
44
**/
55

6-
const _ = window.uxr = function (selector) {
6+
const _ = window['uxr'] = function (selector) {
77
return new uxr(selector);
88
};
99

@@ -323,15 +323,19 @@ _.ready = function (fn) {
323323
_.extend.closest = function (selector) {
324324
let el = this.el[0];
325325

326+
if (!selector) {
327+
return mutated(this, [el.parentNode]);
328+
}
329+
326330
while (el !== null && el.nodeType === 1) {
327331
if (el.matches(selector)) {
328-
return el;
332+
return mutated(this, [el]);
329333
}
330334

331335
el = el.parentNode;
332336
}
333337

334-
return null;
338+
return mutated(this, []);
335339
};
336340

337341
_.extend.next = function (selector) {
@@ -350,6 +354,7 @@ _.extend.last = function () {
350354
let last = this.length - 1;
351355
return mutated(this, this.el.filter((item, index) => index === last));
352356
};
357+
353358
/**
354359
* utils
355360
**/
@@ -498,5 +503,5 @@ _.extend.unwrap = function (selector) {
498503

499504
return this;
500505
};
501-
_.uxr = { version: '0.4.0' };
506+
_.uxr = { version: '0.4.1' };
502507
})();

dist/uxr.min.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uxr",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "DOM utilities",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)