html - Anchor tag href attribute incorrect in IE11 during ace editor change event -
html - Anchor tag href attribute incorrect in IE11 during ace editor change event -
see next fiddle: http://jsfiddle.net/r3vbc/4/
in illustration fiddle, run parsehref function when ace editor's value changes. in turn passes string anchor element used normalise url. can click parse href button run function directly.
var parsehref = function() var anchornodehreforiginal = urlparsingnode.href; urlparsingnode.setattribute("href", 'my-href') var firstpasshref = urlparsingnode.href; urlparsingnode.setattribute("href", firstpasshref) var finalhref = urlparsingnode.href; $('#original-href').html(anchornodehreforiginal); $('#first-pass-href').html(firstpasshref); $('#final-href').html(finalhref); } editor.getsession().on('change', parsehref)
this replicates functionality used angularjs resolve url (see this). relevant trying embed ace editor in angular app.
to reproduce issue experiencing, re-create , paste text (do not type it!) editor. in chrome, values of text displayed @ bottom should http://fiddle.jshell.net/r3vbc/4/show/my-href. if same thing in ie11, values displayed 'my-href'.
if run parsehref function in other way, such typing editor or clicking parse href button, desired result (i.e. http://fiddle.jshell.net/r3vbc/4/show/my-href). seems give wrong value if re-create , paste text editor.
this worked around executing parsehref function window.settimeout (see http://jsfiddle.net/r3vbc/5/)
editor.getsession().on('change', function() { window.settimeout(parsehref); })
so appears somehow ace editor preventing anchor tags resolving correctly in ie11 during alter event. why happening , can prevented?
this ie11 error happens textarea http://jsfiddle.net/r3vbc/6/. urlparsingnode.setattribute("href", firstpasshref) doesn't work when called paste event.
try
textarea.addeventlistener("paste", function(){ parsehref() }) // not useful code snippet, without // `extremely intelligent` site removes jsfiddle link:(
but more importantly shouldn't slow operations, accessing dom, alter event, utilize editor 'input' event fired ~30ms timeout, or utilize own longer timeout.
html angularjs internet-explorer-11 ace-editor
Comments
Post a Comment