Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit aec07ec

Browse files
committed
✨ Added $.getProp()
1 parent ac84948 commit aec07ec

File tree

10 files changed

+72
-4
lines changed

10 files changed

+72
-4
lines changed

__test__/display.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,17 @@ class DisplayJS {
436436
const waitUntil = new Date().getTime() + ms;
437437
while(new Date().getTime() < waitUntil) true;
438438
}
439+
getProp(el) {
440+
el = this.s(el);
441+
return this.extend(el[0], {
442+
text: el[0].innerText,
443+
html: el[0].innerHTML,
444+
css: window.getComputedStyle(el[0]),
445+
height: el[0].outerHeight,
446+
width: el[0].outerWidth,
447+
})
448+
}
449+
439450
// Math and array manipulation + includes
440451
extend( defaults, options ) {
441452
const extended = {};

__test__/dom.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
<div class="predict"></div>
1616
<div class="bg">Hello</div>
1717
<hello-element name="world"></hello-element>
18+
<div class="height"></div>
19+
20+
<style>
21+
.height {
22+
width: 100px;
23+
}
24+
</style>
1825
<script src="/eyejs/" charset="utf-8"></script>
1926
<script src="/static/display.js"></script>
2027
<script>
@@ -55,6 +62,9 @@
5562
eye.test(
5663
$ => $(djs.single("hello-element").innerHTML).Match(/Hello/)
5764
)
65+
eye.test(
66+
$ => $(djs.getProp(".height").css.width).Match(/100px/)
67+
)
5868
setTimeout(() => {
5969
eye.test(
6070
$ => $().visual()

dist/display.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ class DisplayJS {
466466
const waitUntil = new Date().getTime() + ms;
467467
while (new Date().getTime() < waitUntil) true;
468468
}
469+
getProp(el) {
470+
el = this.s(el);
471+
return this.extend(el[0], {
472+
text: el[0].innerText,
473+
html: el[0].innerHTML,
474+
css: window.getComputedStyle(el[0]),
475+
height: el[0].outerHeight,
476+
width: el[0].outerWidth
477+
});
478+
}
479+
469480
// Math and array manipulation + includes
470481
extend(defaults, options) {
471482
const extended = {};

dist/display.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/light/display.es6.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ class DisplayJS {
466466
const waitUntil = new Date().getTime() + ms;
467467
while (new Date().getTime() < waitUntil) true;
468468
}
469+
getProp(el) {
470+
el = this.s(el);
471+
return this.extend(el[0], {
472+
text: el[0].innerText,
473+
html: el[0].innerHTML,
474+
css: window.getComputedStyle(el[0]),
475+
height: el[0].outerHeight,
476+
width: el[0].outerWidth
477+
});
478+
}
479+
469480
// Math and array manipulation + includes
470481
extend(defaults, options) {
471482
const extended = {};

dist/light/display.es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/light/display.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,20 @@ var DisplayJS = (function() {
754754
true;
755755
}
756756
}
757+
},
758+
{
759+
key: "getProp",
760+
value: function getProp(el) {
761+
el = this.s(el);
762+
return this.extend(el[0], {
763+
text: el[0].innerText,
764+
html: el[0].innerHTML,
765+
css: window.getComputedStyle(el[0]),
766+
height: el[0].outerHeight,
767+
width: el[0].outerWidth
768+
});
769+
}
770+
757771
// Math and array manipulation + includes
758772
},
759773
{

0 commit comments

Comments
 (0)