Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
react-vanilla
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
react-vanilla
Commits
30bdb190
Commit
30bdb190
authored
Mar 07, 2021
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
props for document elements for server side rendering
parent
8f99a045
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
25 deletions
+91
-25
DOM.js
DOM.js
+91
-25
No files found.
DOM.js
View file @
30bdb190
...
@@ -253,14 +253,7 @@ NS.apply = function(a,b) {
...
@@ -253,14 +253,7 @@ NS.apply = function(a,b) {
return
el
;
return
el
;
};
};
D
.
h
=
domEl
;
D
.
h
=
domEl
;
D
.
getRect
=
function
(
el
)
{
var
out
=
{
left
:
el
.
offsetLeft
,
top
:
el
.
offsetTop
,
width
:
el
.
clientWidth
,
height
:
el
.
clientHeight
},
pointer
;
while
((
el
=
el
.
offsetParent
)){
out
.
left
+=
el
.
offsetLeft
;
out
.
top
+=
el
.
offsetTop
;
}
return
out
;
};
D
.
ext
=
function
(
el
,
cfg
)
{
D
.
ext
=
function
(
el
,
cfg
)
{
cfg
.
el
=
el
;
cfg
.
el
=
el
;
if
(
cfg
.
cls
){
if
(
cfg
.
cls
){
...
@@ -274,6 +267,7 @@ NS.apply = function(a,b) {
...
@@ -274,6 +267,7 @@ NS.apply = function(a,b) {
D
.
isInDOM
=
function
(
el
)
{
D
.
isInDOM
=
function
(
el
)
{
return
document
.
body
.
contains
(
el
);
return
document
.
body
.
contains
(
el
);
};
};
D
.
_recursiveCmpCall
=
function
(
el
,
sub
,
fnName
){
D
.
_recursiveCmpCall
=
function
(
el
,
sub
,
fnName
){
if
(
sub
.
__cmp
)
if
(
sub
.
__cmp
)
sub
.
__cmp
[
fnName
]
&&
sub
.
__cmp
[
fnName
](
el
);
sub
.
__cmp
[
fnName
]
&&
sub
.
__cmp
[
fnName
](
el
);
...
@@ -526,6 +520,8 @@ NS.apply = function(a,b) {
...
@@ -526,6 +520,8 @@ NS.apply = function(a,b) {
}
}
};
};
//#declaration
var
usage
=
{};
var
usage
=
{};
var
populate
=
function
(
name
,
construct
)
{
var
populate
=
function
(
name
,
construct
)
{
var
tokens
=
name
.
split
(
'.'
),
var
tokens
=
name
.
split
(
'.'
),
...
@@ -638,6 +634,11 @@ NS.apply = function(a,b) {
...
@@ -638,6 +634,11 @@ NS.apply = function(a,b) {
later
=
setTimeout
(
realLog
,
3000
);
later
=
setTimeout
(
realLog
,
3000
);
};
};
//#end declaration
//#subscribe
var
emptyFn
=
function
()
{};
var
emptyFn
=
function
()
{};
D
.
Unsubscribe
=
function
(
fn
)
{
D
.
Unsubscribe
=
function
(
fn
)
{
...
@@ -678,24 +679,9 @@ NS.apply = function(a,b) {
...
@@ -678,24 +679,9 @@ NS.apply = function(a,b) {
move
:
unsubscribable
(
'mousemove'
),
move
:
unsubscribable
(
'mousemove'
),
over
:
unsubscribable
(
'mouseover'
),
over
:
unsubscribable
(
'mouseover'
),
};
};
//#end subscribe
D
.
AnimationFrame
=
function
(
fn
)
{
//#overlay
var
requested
=
false
,
arg
,
update
=
function
()
{
fn
.
call
(
null
,
arg
);
requested
=
false
;
};
return
function
(
a
)
{
arg
=
a
;
if
(
!
requested
){
requestAnimationFrame
(
update
);
requested
=
true
;
}
};
};
D
.
overlay
=
{
D
.
overlay
=
{
inited
:
false
,
inited
:
false
,
show
:
function
()
{
show
:
function
()
{
...
@@ -719,6 +705,8 @@ NS.apply = function(a,b) {
...
@@ -719,6 +705,8 @@ NS.apply = function(a,b) {
},
true
)
},
true
)
}
}
};
};
//#end overlay
//#util
D
.
findParent
=
function
(
el
,
fn
)
{
D
.
findParent
=
function
(
el
,
fn
)
{
var
test
;
var
test
;
while
(
el
){
while
(
el
){
...
@@ -729,8 +717,86 @@ NS.apply = function(a,b) {
...
@@ -729,8 +717,86 @@ NS.apply = function(a,b) {
el
=
el
.
parentNode
el
=
el
.
parentNode
}
}
};
};
D
.
getRect
=
function
(
el
)
{
var
out
=
{
left
:
el
.
offsetLeft
,
top
:
el
.
offsetTop
,
width
:
el
.
clientWidth
,
height
:
el
.
clientHeight
},
pointer
;
while
((
el
=
el
.
offsetParent
)){
out
.
left
+=
el
.
offsetLeft
;
out
.
top
+=
el
.
offsetTop
;
}
return
out
;
};
D
.
AnimationFrame
=
function
(
fn
)
{
var
requested
=
false
,
arg
,
update
=
function
()
{
fn
.
call
(
null
,
arg
);
requested
=
false
;
};
return
function
(
a
)
{
arg
=
a
;
if
(
!
requested
){
requestAnimationFrame
(
update
);
requested
=
true
;
}
};
};
//#end util
D
.
s
=
D
.
h
;
D
.
s
=
D
.
h
;
// #build
var
doc
=
document
;
D
.
shimDocument
=
function
(
cid
)
{
cid
=
cid
||
0
;
document
=
{
body
:
doc
.
body
,
querySelectorAll
:
function
(
selector
)
{
return
doc
.
querySelectorAll
(
selector
);
},
createDocumentFragment
:
function
()
{
return
doc
.
createDocumentFragment
();
},
createElement
:
function
(
tagName
,
options
)
{
var
el
=
doc
.
createElement
(
tagName
,
options
);
el
.
___id
=
cid
++
;
return
el
;
},
createTextNode
:
function
(
data
)
{
var
el
=
doc
.
createTextNode
(
data
);
el
.
___id
=
cid
++
;
return
el
;
},
createElementNS
:
function
(
namespaceURI
,
qualifiedName
){
var
el
=
doc
.
createElement
(
namespaceURI
,
qualifiedName
);
el
.
___id
=
cid
++
;
return
el
;
}
};
};
D
.
unshimDocument
=
function
()
{
document
=
doc
;
};
var
sequence
=
function
(
el
,
out
){
out
=
out
||
[];
if
(
el
.
nodeType
===
3
){
// textNode
out
.
push
(
el
.
cid
)
//el.cid
}
else
{
out
.
push
(
el
.
cid
)
var
children
=
el
.
childNodes
;
for
(
var
i
=
0
,
_i
=
children
.
length
;
i
<
_i
;
i
++
){
rec
(
children
[
i
],
out
);
}
}
return
out
;
}
D
.
collectOrder
=
function
(
el
)
{
return
sequence
(
el
||
doc
.
body
)
}
// #end build
})(
window
[
'NS'
],
typeof
window
!==
"undefined"
?
window
:
})(
window
[
'NS'
],
typeof
window
!==
"undefined"
?
window
:
typeof
WorkerGlobalScope
!==
"undefined"
?
self
:
typeof
WorkerGlobalScope
!==
"undefined"
?
self
:
typeof
global
!==
"undefined"
?
global
:
typeof
global
!==
"undefined"
?
global
:
...
...
Write
Preview
Markdown
is supported
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