forked from forgejo/forgejo
Avoid showing unnecessary JS errors when there are elements with different origin on the page (#29081) (#29089)
Backport #29081 by wxiaoguang Try to fix #29080 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 9a4d283e9ac472dca869356c27db05039673c638)
This commit is contained in:
parent
628e1036cf
commit
614ba2b257
3 changed files with 19 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
// for performance considerations, it only uses performant syntax
|
||||
import {isDocumentFragmentOrElementNode} from '../utils/dom.js';
|
||||
|
||||
// for performance considerations, it only uses performant syntax
|
||||
function attachDirAuto(el) {
|
||||
if (el.type !== 'hidden' &&
|
||||
el.type !== 'checkbox' &&
|
||||
|
@ -18,7 +19,7 @@ export function initDirAuto() {
|
|||
const len = mutation.addedNodes.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const addedNode = mutation.addedNodes[i];
|
||||
if (addedNode.nodeType !== Node.ELEMENT_NODE && addedNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) continue;
|
||||
if (!isDocumentFragmentOrElementNode(addedNode)) continue;
|
||||
if (addedNode.nodeName === 'INPUT' || addedNode.nodeName === 'TEXTAREA') attachDirAuto(addedNode);
|
||||
const children = addedNode.querySelectorAll('input, textarea');
|
||||
const len = children.length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue