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
Where there are multiple container elements with children having the same ID attribute, jQuery selector selects only the first elements from the first container with matching ID, but all elements from the following containers. Even though if elements shouldn't share the same ID attribute this behavior may lead to hardly traceable bugs/malfunctions.
Thanks for the report. However, this behavior is intended - when passing just an ID, we use a shortcut via getElementById for performance reasons; in other cases it goes to querySelectorAll as long as the browser recognizes the selector. We take an assumption that the HTML structure is correct, in these cases both behaviors is compatible.
Description
Where there are multiple container elements with children having the same ID attribute, jQuery selector selects only the first elements from the first container with matching ID, but all elements from the following containers. Even though if elements shouldn't share the same ID attribute this behavior may lead to hardly traceable bugs/malfunctions.
Link to test case
https://codepen.io/resetcoder/pen/dyOObbB
Code
Output
The text was updated successfully, but these errors were encountered: