1
1
/**
2
2
* Inter.
3
- * Version: 1.1.2
3
+ * Version: 1.1.3
4
4
* 2021 - by Denis Power.
5
5
* https://github.com/DenisPower1/inter
6
6
* A Javascript framework to build interactive frontend applications.
@@ -81,6 +81,7 @@ function Warning(err){
81
81
}
82
82
83
83
function getId ( id ) {
84
+ if ( document instanceof Document ) {
84
85
const theId = document . getElementById ( id ) ;
85
86
if ( theId == void 0 ) {
86
87
SyntaxErr ( `
@@ -91,6 +92,9 @@ if(theId== void 0){
91
92
92
93
return theId ;
93
94
}
95
+ } else {
96
+ return void 0 ;
97
+ }
94
98
}
95
99
96
100
function consoleWarnig ( msm ) {
@@ -103,16 +107,28 @@ function consoleWarnig(msm){
103
107
}
104
108
105
109
function TEXT ( node ) {
110
+ if ( document instanceof Document ) {
106
111
return document . createTextNode ( node ) ;
112
+ } else {
113
+ return void 0 ;
114
+ }
107
115
}
108
116
function hasAttr ( el , attr ) {
117
+ if ( el != void 0 ) {
109
118
if ( isElement ( el ) ) {
110
119
return el . hasAttribute ( attr ) ;
111
120
}
121
+ } else {
122
+ return false ;
123
+ }
112
124
}
113
125
114
126
function CreatEL ( EL ) {
127
+ if ( document instanceof Document ) {
115
128
return document . createElement ( EL )
129
+ } else {
130
+ return void 0 ;
131
+ }
116
132
} ;
117
133
118
134
function setAttr ( el , attr , value ) {
@@ -435,6 +451,7 @@ return first>second ? first : second;
435
451
}
436
452
function noTextTag ( first , second ) {
437
453
454
+ //These are just the tags that must not be rerendered.
438
455
const noTextTag = {
439
456
video :! 0 ,
440
457
audio :! 0 ,
@@ -616,6 +633,7 @@ const parser={
616
633
}
617
634
618
635
636
+
619
637
/**
620
638
* Changing the onload method, for inputHandler be more performant.
621
639
*
@@ -769,13 +787,13 @@ var validate=new Proxy(validator,{
769
787
const INTER = new HTML ( ) ;
770
788
const Inter = new Proxy ( INTER , {
771
789
set ( ...values ) {
772
- SyntaxErr ( `You can not set any propriety in object Inter,
790
+ SyntaxErr ( `You can not set any property in Inter object ,
773
791
this is a fatal action.
774
792
` ) ;
775
793
return false ;
776
794
} ,
777
795
deleteProperty ( ...values ) {
778
- SyntaxErr ( `Fatal error: do not try to delete any propriety of Inter object` ) ;
796
+ SyntaxErr ( `Fatal error: do not try to delete any property of Inter object` ) ;
779
797
return false ;
780
798
} ,
781
799
getPrototypeOf ( Target ) {
@@ -835,7 +853,7 @@ The argument in data.query() must be an object.
835
853
}
836
854
let filtered = IN . filter ( item => {
837
855
if ( ! hasOwn . call ( item , query ) ) {
838
- console . log ( `There was not found a property called ${ query } in target object. ` )
856
+ console . log ( `It's was not found a property called " ${ query } " in target object, in data.query() ` )
839
857
}
840
858
const keyword = item [ query ] ;
841
859
let lower = lowerCase . call ( keyword ) ;
@@ -1010,7 +1028,7 @@ function isaNodeElement(supposedElement){
1010
1028
1011
1029
/**
1012
1030
*There is already a function that do a work similiar to this, called
1013
- *isElement(), but that function does not work as espected in Inter.renderIf() checking,
1031
+ *isElement(), but that function does not work as expected in Inter.renderIf() checking,
1014
1032
* that's why I'm doing
1015
1033
* a strong checking with this one.
1016
1034
*/
@@ -1152,8 +1170,7 @@ definePro(Inter, "renderIf",(obj)=>{
1152
1170
1153
1171
1154
1172
else {
1155
- SyntaxErr ( `The last rendered children in element by id ${ IN } is at index ${ allundeepChildren } and
1156
- to render a children at index ${ pos } .
1173
+ SyntaxErr ( `Invalid index, it's impossible to render the element at index "${ pos } "!
1157
1174
` )
1158
1175
1159
1176
}
@@ -1207,7 +1224,7 @@ class SIMULATE{
1207
1224
* semulate.typing({
1208
1225
* in:"container",
1209
1226
* setting:[{
1210
- * text:"Hey, i 'm Denis the creator of Inter.",
1227
+ * text:"Hey, I 'm Denis the creator of Inter.",
1211
1228
* speed:100
1212
1229
* }]
1213
1230
* })
@@ -1336,7 +1353,8 @@ const{
1336
1353
elements,
1337
1354
} = obj ;
1338
1355
1339
- //Note: render is just usual for reative template.
1356
+ //Note: render is just usual for reactive template.
1357
+
1340
1358
/**
1341
1359
* templates({
1342
1360
* elements:[{
@@ -1454,15 +1472,15 @@ let tags=array.create(null);
1454
1472
const [ evName , evValue ] = ev ;
1455
1473
1456
1474
childElement [ evName ] = evValue ;
1457
- childElement [ `_${ evName } ` ] = evValue ; //Reative template
1458
- childElement . rerender = true ; // Reative listining .
1475
+ childElement [ `_${ evName } ` ] = evValue ; //Reactive template
1476
+ childElement . rerender = true ; // Reactive listing .
1459
1477
} )
1460
1478
1461
1479
Object . values ( _handlers ) . forEach ( handler => {
1462
1480
1463
1481
if ( isCallable ( handler ) ) {
1464
1482
childElement . rerender = true ;
1465
- return _handlers [ handler ] . call ( childElement ) ;
1483
+ handler . call ( childElement ) ;
1466
1484
}
1467
1485
} )
1468
1486
Object . entries ( _styles ) . forEach ( sty => {
@@ -1518,7 +1536,7 @@ let tags=array.create(null);
1518
1536
1519
1537
if ( isCallable ( value ) ) {
1520
1538
grand_son . rerender = true ;
1521
- value ( )
1539
+ value . call ( grand_son )
1522
1540
}
1523
1541
1524
1542
} )
@@ -2014,7 +2032,7 @@ BACKEND.prototype.request=function(obj){
2014
2032
2015
2033
}
2016
2034
}
2017
- const backend = new BACKEND ( ) ;
2035
+ const backend = Object . freeze ( new BACKEND ( ) ) ;
2018
2036
2019
2037
const globalNativeEventListener = {
2020
2038
0 commit comments