0

I have an application with knockout.js

In IE 11 I get error

SCRIPT5022: WrongDocumentError

I have tried to find the reason of this issue. After some time I think it can be due to BOM (Byte order mark) as this symbol is returned in knockout views/html files.

<div class="container-fluid explore">
...
</div>

So am I right about BOM and error? If yes, how to disable it from my views? I tried to save some views without encoding, but seems it doesn't help.

I'm using VS2017.


It's kinda my call stack where I can go to current/errored place https://prnt.sc/qxgj6b


UPD:

Finally, I managed to find place where this exception is raised.

So basically in knockout is possible to create custom components. They can look like custom html tags with some data as passed params.

my-dropdown is my custom component, that should be "translated" into next html:

<select class="my-dropdown" data-bind="options: data, optionsText: optionText, optionsValue: optionValue, value: selectedValue">

In knockout this "translation" is made in next way (if I correctly understood it):

b.appendChild(c[d])

where b - is [object HTMLUnknownElement] that represent my custom component in html file <my-dropdown>...</my-dropdown> c[d] - is [object HTMLSelectElement] that is my "translation" of component <select>...</select>

So on .appendChild error is thrown.

demo
  • 5,376
  • 12
  • 55
  • 130
  • does this help? [Fix File Encoding](https://vlasovstudio.com/fix-file-encoding/index.html) – deblocker Jan 25 '20 at 13:55
  • @deblocker, well, I resaved without signature my files, but it doesn't help me. So don't know if problem is in BOM. – demo Jan 25 '20 at 14:41
  • @demo, this error typically arises when trying to append a node that belongs to one document (e.g., an XML) to another document (e.g., your HTML document). Do you have something similar in your code? – OfirD Jan 26 '20 at 11:07
  • @HeyJude Need to search one more time, cause after first time didn't find something like that. Thx for now ) – demo Jan 26 '20 at 11:51
  • @HeyJude, can it be simple knockout views/ html components? – demo Jan 31 '20 at 15:38
  • @demo, unlikely, in my opinion. track down the stack trace of the error, and research backwards from there. – OfirD Feb 01 '20 at 16:31
  • @HeyJude my call stack looks like useless... http://prntscr.com/qxgj6b I cannot "Go to source" except of current position. – demo Feb 04 '20 at 15:33
  • @demo, can you double click any of the `[Async Call]` stack frames? if so, what do you see there? also, on the moment you get the error, notice you have a variable named `b`, so try printing `b.stack` to console. What do you see? also - can you try it in another browser except for IE? – OfirD Feb 04 '20 at 15:44
  • @HeyJude, clicking on other [Async Call] isn't possible. `b.stack` is undefined. In other browsers it is fine – demo Feb 04 '20 at 16:14
  • @demo, I mistaked `b` to be an exception object, and it's not; so just print `b` - is there something helpful there? also, what `` tags you're using? – OfirD Feb 04 '20 at 16:18
  • @HeyJude `` – demo Feb 04 '20 at 16:22
  • @demo, try add ``. any change? read [this](https://stackoverflow.com/a/6080299/3002584) answer, it may be related, and also [this post](https://stackoverflow.com/q/6771258/3002584). I'm out of ideas, otherwise. – OfirD Feb 04 '20 at 16:28

0 Answers0