Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zaide
BakuJS
Commits
9385bc95
Commit
9385bc95
authored
Jan 22, 2016
by
Zéfling
🎨
Browse files
Update baku.dom.js
Change Array pour DomArray
parent
44280adb
Changes
1
Hide whitespace changes
Inline
Side-by-side
baku.dom.js
View file @
9385bc95
...
...
@@ -5,7 +5,10 @@ baku._list = document.querySelectorAll;
baku
.
_new
=
document
.
createElement
;
baku
.
_frag
=
document
.
createDocumentFragment
;
var
DomArray
=
function
()
{};
for
(
key
in
Array
.
prototype
)
{
DomArray
.
prototype
[
key
]
=
Array
.
prototype
[
key
];
}
/**
* ajout d'un style sur un élement.
...
...
@@ -43,7 +46,7 @@ HTMLElement.prototype._css = function (name, value) {
* @return valeur ou undefined si non trouvée
*/
NodeList
.
prototype
.
_css
=
Array
.
prototype
.
_css
=
function
(
name
,
value
)
{
Dom
Array
.
prototype
.
_css
=
function
(
name
,
value
)
{
for
(
var
i
in
this
)
{
if
(
this
[
i
]
instanceof
HTMLElement
)
{
this
[
i
].
_css
(
name
,
value
);
...
...
@@ -58,7 +61,7 @@ Array.prototype._css = function (name, value) {
* @return la liste
*/
NodeList
.
prototype
.
_addClass
=
Array
.
prototype
.
_addClass
=
function
(
name
)
{
Dom
Array
.
prototype
.
_addClass
=
function
(
name
)
{
for
(
var
i
in
this
)
{
if
(
this
[
i
]
instanceof
HTMLElement
)
{
this
[
i
].
classList
.
add
(
name
);
...
...
@@ -73,7 +76,7 @@ Array.prototype._addClass = function (name) {
* @return la liste
*/
NodeList
.
prototype
.
_rmClass
=
Array
.
prototype
.
_rmClass
=
function
(
name
)
{
Dom
Array
.
prototype
.
_rmClass
=
function
(
name
)
{
for
(
var
i
in
this
)
{
if
(
this
[
i
]
instanceof
HTMLElement
)
{
this
[
i
].
classList
.
remove
(
name
);
...
...
@@ -88,7 +91,7 @@ Array.prototype._rmClass = function (name) {
* @return element
*/
NodeList
.
prototype
.
_first
=
Array
.
prototype
.
_first
=
function
(
selector
)
{
Dom
Array
.
prototype
.
_first
=
function
(
selector
)
{
var
e
=
new
HTMLElement
();
for
(
var
i
in
this
)
{
if
(
this
[
i
]
instanceof
HTMLElement
&&
(
e
=
this
[
i
].
querySelector
(
selector
))
!==
undefined
)
{
...
...
@@ -104,8 +107,8 @@ Array.prototype._first = function (selector) {
* @return la liste
*/
NodeList
.
prototype
.
_list
=
Array
.
prototype
.
_list
=
function
(
selector
)
{
var
e
,
k
=
0
,
list
=
new
Array
();
Dom
Array
.
prototype
.
_list
=
function
(
selector
)
{
var
e
,
k
=
0
,
list
=
new
Dom
Array
();
for
(
var
i
in
this
)
{
if
(
this
[
i
]
instanceof
HTMLElement
)
{
e
=
this
[
i
].
querySelectorAll
(
selector
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment