Open djkad opened 4 years ago
Does Tagify actually works on real IOS? (not cordova)
Does Tagify actually works on real IOS? (not cordova)
No :(
I will investigate this
Thank you a lot. I'll do the same because it's a very nice library and it's working very well with web and with cordova-android app.
The problem happens when i call the AddTags:
tagify.addTags([{value:$(this).data("value_tag"), id_tag:$(this).data("id_tag")}]);
It seems a problem of the DOM Parser acting weird.
I've tried to change the code:
parseHTML: function (t) { return new DOMParser().parseFromString(t.trim(), "text/html").body.firstElementChild; },
with
parseHTML: function (t) { let doc = new DOMParser().parseFromString(t.trim(), "text/html"); console.log(doc); console.log(doc.body); console.log(doc.body.firstElementChild); return doc.body.firstElementChild; },
first console.log contain all the dom
second console.log return only <body><body>
(like it's empty...although all body content -with the tag- is inside doc)
third console.log give me the error null is not blabla
But is the problem only with Safari? does it work with other browsers on IOS?
is this related to the issue? https://stackoverflow.com/q/33472302/104380
But is the problem only with Safari? does it work with other browsers on IOS? It works also with safari on mac. The problem affect only cordova ios app (they are like normal webapp inside a webview container) is this related to the issue? https://stackoverflow.com/q/33472302/104380 I'll try it later, thanks a lot
is this related to the issue? https://stackoverflow.com/q/33472302/104380
unfortunatelly not, because i made an isolated parse test and DOMParser seems work. I continue to check
I found the problem but i don't know how to solve. In cordova-ios DOMParser() works only for the first time you call. if you place this code inside the parseHTML method:
let test='<html><head></head><body>TEST</body></html>';
let doc = new DOMParser().parseFromString(test.trim(), "text/html");
console.log(doc.body);
First time that tagify call the method parseHTML (when you create the tagify), console.log return this:
<body>TEST</body>
Second time (when you call the addTags)
NULL
Although console.log(doc) will gives you the entire tree.
@djkad - I think you should file a report here: https://github.com/apache/cordova-ios/issues/new/choose
Can you make a Cordova test app which only has this:
let test='<html><head></head><body>TEST</body></html>';
let doc = new DOMParser().parseFromString(test.trim(), "text/html");
console.log(doc.body);
doc = new DOMParser().parseFromString(test.trim(), "text/html");
console.log(doc.body);
To isolate the problem and make sure if it's truly only happens when calling DOMParser
more than once
Explanation
Everything works fine on cordova(android) and all web browsers like chrome,safari an so on. But on Cordova Ios i have problem with the function parseHTML.