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
f982fc02
Commit
f982fc02
authored
Apr 26, 2021
by
Иван Кубота
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix reactive property setter in DOM
added test for it
parent
274eb82d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
DOM.js
DOM.js
+2
-2
dom-store.js
test/dom-store.js
+10
-0
No files found.
DOM.js
View file @
f982fc02
...
@@ -132,7 +132,7 @@ NS.apply = function(a,b) {
...
@@ -132,7 +132,7 @@ NS.apply = function(a,b) {
if
(
typeof
style
[
i
]
===
'function'
){
if
(
typeof
style
[
i
]
===
'function'
){
style
[
i
](
setters
.
style
(
s
,
i
)
);
style
[
i
](
setters
.
style
(
s
,
i
)
);
}
else
if
(
typeof
style
[
i
]
===
'object'
&&
style
[
i
]
!==
null
&&
style
[
i
].
hook
){
}
else
if
(
typeof
style
[
i
]
===
'object'
&&
style
[
i
]
!==
null
&&
style
[
i
].
hook
){
return
style
[
i
].
hook
(
setters
.
style
(
s
,
i
));
style
[
i
].
hook
(
setters
.
style
(
s
,
i
));
}
else
{
}
else
{
setters
.
style
(
s
,
i
)(
style
[
i
]
);
setters
.
style
(
s
,
i
)(
style
[
i
]
);
}
}
...
@@ -147,7 +147,7 @@ NS.apply = function(a,b) {
...
@@ -147,7 +147,7 @@ NS.apply = function(a,b) {
if
(
typeof
attr
[
i
]
===
'function'
){
if
(
typeof
attr
[
i
]
===
'function'
){
attr
[
i
](
setters
.
attr
(
el
,
i
)
);
attr
[
i
](
setters
.
attr
(
el
,
i
)
);
}
else
if
(
typeof
attr
[
i
]
===
'object'
&&
attr
[
i
]
!==
null
&&
attr
[
i
].
hook
){
}
else
if
(
typeof
attr
[
i
]
===
'object'
&&
attr
[
i
]
!==
null
&&
attr
[
i
].
hook
){
return
attr
[
i
].
hook
(
setters
.
attr
(
el
,
i
));
attr
[
i
].
hook
(
setters
.
attr
(
el
,
i
));
}
else
{
}
else
{
setters
.
attr
(
el
,
i
)(
attr
[
i
]
);
setters
.
attr
(
el
,
i
)(
attr
[
i
]
);
}
}
...
...
test/dom-store.js
View file @
f982fc02
...
@@ -18,6 +18,16 @@ describe('DOM with Store', function(){
...
@@ -18,6 +18,16 @@ describe('DOM with Store', function(){
assert
.
equal
(
div
.
outerHTML
,
'<div data-hooked="yep">d</div>'
);
assert
.
equal
(
div
.
outerHTML
,
'<div data-hooked="yep">d</div>'
);
}
);
}
);
it
(
'should create simple a href with reactive values'
,
function
(){
var
href
=
new
Store
.
Value
.
String
(
'href'
);
var
val
=
new
Store
.
Value
.
String
(
'txt'
);
var
div
=
D
.
h
(
'a'
,
{
href
:
href
},
val
);
assert
.
equal
(
div
.
outerHTML
,
'<a href="href" data-hooked="yep">txt</a>'
);
href
.
set
(
'href2'
);
val
.
set
(
'txt2'
);
assert
.
equal
(
div
.
outerHTML
,
'<a href="href2" data-hooked="yep">txt2</a>'
);
}
);
it
(
'should set reactive cls'
,
function
(){
it
(
'should set reactive cls'
,
function
(){
var
val
=
new
Store
.
Value
.
String
(
'c'
),
var
val
=
new
Store
.
Value
.
String
(
'c'
),
bool
=
new
Store
.
Value
.
Boolean
(
false
);
bool
=
new
Store
.
Value
.
Boolean
(
false
);
...
...
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