You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect that my select list defaults to 1 when the page is loaded. However, after including the linkify() call it defaults to 5 (in FF the last item in the select list, in chrome seems to be some random element). It completely ignores <option selected>3</option> as well.
I have confirmed both the 1.x and 2.x versions show the same issue. I'm going to try to hack around to see if I can identify the issue but was curious if any others had experienced the same thing.
update
Looks the following code is causing the issue (tearing down the select list options and rebuilding them). This causes the rebuilt select list to land on the last element (regardless of selected or default value):
// linkify-jquery.js, 2.0 master, line 99-107// Clear out the elementwhile(element.firstChild){element.removeChild(element.firstChild);}// Replace with all the new nodesfor(vari=0;i<children.length;i++){element.appendChild(children[i]);}
Not exactly sure how to address this. I'm wondering if I can just build a CSS selector that skips <select> elements for now?
The text was updated successfully, but these errors were encountered:
Hi @krsyoung, big thanks for reporting the issue and going out of your way to find out the cause. Your suggestion to somehow ignore <select> elements makes sense, but really the issue is that we're rebuilding the DOM here when all we need to do is replace a few text nodes.
The proper fix here would be to avoid removing/appending DOM nodes that linkify doesn't touch (i.e., anything that isn't a Text node), probably using something like insertBefore.
I'll see if I can issue a fix for it soon. For now, I would avoid calling Linkify on elements that contain select lists.
Thanks @nfrasser! Your fix suggestion definitely sounds like the way to go.
I also went with your suggestion (to basically stop being so lazy) and be a little more selective with the linkify targets (I actually used a customized version of the data-linkify which also works with page:load vs just document ready). Working like a charm.
I'm currently experiencing an issue where linkify is "changing" the values within my
<select>
lists. The following code illustrates the issue:I would expect that my select list defaults to 1 when the page is loaded. However, after including the
linkify()
call it defaults to 5 (in FF the last item in the select list, in chrome seems to be some random element). It completely ignores<option selected>3</option>
as well.I have confirmed both the 1.x and 2.x versions show the same issue. I'm going to try to hack around to see if I can identify the issue but was curious if any others had experienced the same thing.
update
Looks the following code is causing the issue (tearing down the select list options and rebuilding them). This causes the rebuilt select list to land on the last element (regardless of
selected
or default value):Not exactly sure how to address this. I'm wondering if I can just build a CSS selector that skips
<select>
elements for now?The text was updated successfully, but these errors were encountered: