From 12992f7229f1291719717a1832cf0afd1a8d7c29 Mon Sep 17 00:00:00 2001 From: JMRY <376509849@qq.com> Date: Thu, 14 Mar 2024 09:43:54 +0800 Subject: [PATCH] =?UTF-8?q?-=20Version:=201.1.13=20Build=2020240314=20=09-?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4jQueryDOM=E6=95=B0=E7=BB=84=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F=E6=8F=92=E5=85=A5=E5=85=83=E7=B4=A0=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=EF=BC=8Cprepend=E5=92=8Cbefore=E5=80=92=E8=BD=AC?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=BB=A5=E7=A1=AE=E4=BF=9D=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E5=92=8C=E6=95=B0=E7=BB=84=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.md | 3 +++ jquery.extensions.dom.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/VERSION.md b/VERSION.md index 220e092..bed2504 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,5 +1,8 @@ # JQuery DOM +- Version: 1.1.13 Build 20240314 + - 调整jQueryDOM数组形式插入元素的方式,prepend和before倒转数组以确保插入顺序和数组顺序一致。 + - Version: 1.1.12 Build 20240124 - 优化dom_attr的处理逻辑和性能。 - 优化dom_attr传入规则,防止传入无效字段。 diff --git a/jquery.extensions.dom.js b/jquery.extensions.dom.js index 2ea457c..ca07fa7 100644 --- a/jquery.extensions.dom.js +++ b/jquery.extensions.dom.js @@ -279,6 +279,10 @@ if(typeof jQuery===`function`){ let default_children={ tag:undefined,attr:undefined,html:undefined,attachType:`append` }; + if(attach_type==`prepend` || attach_type==`before`){ + //往前插入时,将数组调转,以确保插入顺序和数组顺序一致 + dom_tag.reverse(); + } for(let cur of dom_tag){ cur={ ...JSON.parse(JSON.stringify(default_children)),