From 87dfd1a31381b1ba7eb84de5a8475fec8cbc80e4 Mon Sep 17 00:00:00 2001 From: Grant Copley Date: Tue, 17 Sep 2024 16:56:10 -0500 Subject: [PATCH] Speed increase --- models/Component.cfc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/models/Component.cfc b/models/Component.cfc index d629ae7..d251575 100644 --- a/models/Component.cfc +++ b/models/Component.cfc @@ -1006,8 +1006,17 @@ component output="true" { local.wireAttributes = 'wire:snapshot="' & arguments.snapshotEncoded & '" wire:effects="#_generateWireEffectsAttribute()#" wire:id="#variables._id#"'; // Determine our outer element local.outerElement = _getOuterElement( arguments.html ); + // Find the position of the opening tag + local.openingTagStart = findNoCase("<" & local.outerElement, arguments.html); + local.openingTagEnd = find(">", arguments.html, local.openingTagStart); // Insert attributes into the opening tag - return arguments.html.reReplaceNoCase( "<" & local.outerElement & "\s*", "<" & local.outerElement & " " & local.wireAttributes & " ", "one" ); + if (local.openingTagStart > 0 && local.openingTagEnd > 0) { + local.openingTag = mid(arguments.html, local.openingTagStart, local.openingTagEnd - local.openingTagStart + 1); + local.newOpeningTag = replace(local.openingTag, "<" & local.outerElement, "<" & local.outerElement & " " & local.wireAttributes, "one"); + arguments.html = replace(arguments.html, local.openingTag, local.newOpeningTag, "one"); + } + + return arguments.html; } /**