Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active November 10, 2025 19:21
Show Gist options
  • Select an option

  • Save JamoCA/b67c776d31e9a5c20b63e3a2f72a152e to your computer and use it in GitHub Desktop.

Select an option

Save JamoCA/b67c776d31e9a5c20b63e3a2f72a152e to your computer and use it in GitHub Desktop.

Revisions

  1. JamoCA revised this gist Nov 10, 2025. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion TestCustomTag.cfm
    Original file line number Diff line number Diff line change
    @@ -39,6 +39,10 @@ Call this as a custom tag using a CFTag or cfscript
    <cfdump var="#isdefined('t.executionMode')#">
    <cfdump var="#isdefined('t.hasEndTag')#">

    <h2>WORKAROUND: Using TRY/Catch to capture "thisTag.executionMode" value.</h2>
    <cftry><cfset tagMode = thisTag.executionMode><cfcatch><cfset tagMode = ""></cfcatch></cftry>
    <cfdump var="#tagMode#">

    <cfif structkeyexists(server, "boxlang")>
    <h2>"thisComponent" (BoxLang only) works in BoxLang with isdefined().</h2>
    <cftry>
    @@ -48,4 +52,4 @@ Call this as a custom tag using a CFTag or cfscript
    <h2 style="color:red;">ERROR: "thisComponent" should work in BoxLang.</h2>
    </cfcatch>
    </cftry>
    </cfif>
    </cfif>
  2. JamoCA revised this gist Nov 10, 2025. 1 changed file with 34 additions and 16 deletions.
    50 changes: 34 additions & 16 deletions TestCustomTag.cfm
    Original file line number Diff line number Diff line change
    @@ -1,33 +1,51 @@
    <!---
    11/8/2025 19:45:05
    11/10/2025 11:17:33
    Custom Tag "thisTag" scope test.
    Call this as a custom tag using a CFTag or cfscript
    <cf_TestCustomTag>
    or
    cf_TestCustomTag();
    <cf_TestCustomTag>
    or
    cf_TestCustomTag();
    --->


    <cfdump var="#thisTag#">
    <div>isdefined() should return TRUE; works in ACF 2016-2025 and Lucee 5-7</div>
    <h2>Dump "thisTag"</h2>
    <cftry>
    <cfdump var="#thisTag#">
    <cfcatch>
    <div style="color:red;">ERROR: thisTag scope doesn't exist.</div>
    </cfcatch>
    </cftry>

    <h2>isdefined() should return TRUE (works in ACF 2016-2025 and Lucee 5-7)</h2>
    <cfdump var="#isdefined('thisTag.executionMode')#">
    <cfdump var="#isdefined('thisTag.hasEndTag')#">

    <div>structkeyexists() returns TRUE</div>
    <h2>structkeyexists() should return TRUE.</h2>
    <cfdump var="#structkeyexists(thisTag, 'executionMode')#">
    <cfdump var="#structkeyexists(thisTag, 'hasEndTag')#">

    <div>if thisTag scope is duplicated, isdefined() works</div>
    <h2>OK... does "variables.thisTag" exist? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2>
    <cfdump var="#structkeyexists(variables, 'thisTag')#">

    <h2>Is "thisTag" defined? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2>
    <cfdump var="#isdefined('thisTag')#">

    <h2>Is "variables.thisTag" defined? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2>
    <cfdump var="#isdefined('variables.thisTag')#">

    <h2>if "thisTag" scope is duplicated, isdefined() works in BoxLang using the duplicated scope.</h2>
    <cfset t = duplicate(thisTag)>
    <cfdump var="#isdefined('t.executionMode')#">
    <cfdump var="#isdefined('t.hasEndTag')#">

    <cftry>
    <cfdump var="#thisComponent#">
    <cfdump var="#isdefined('thisComponent.executionMode')#">
    <cfdump var="#isdefined('thisComponent.hasEndTag')#">
    <cfcatch>
    <div>"thisComponent" only works in BoxLang.</div>
    </cfcatch>
    </cftry>
    <cfif structkeyexists(server, "boxlang")>
    <h2>"thisComponent" (BoxLang only) works in BoxLang with isdefined().</h2>
    <cftry>
    <cfdump var="#isdefined('thisComponent.executionMode')#">
    <cfdump var="#isdefined('thisComponent.hasEndTag')#">
    <cfcatch>
    <h2 style="color:red;">ERROR: "thisComponent" should work in BoxLang.</h2>
    </cfcatch>
    </cftry>
    </cfif>
  3. JamoCA revised this gist Nov 9, 2025. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions TestCustomTag.cfm
    Original file line number Diff line number Diff line change
    @@ -10,15 +10,15 @@ Call this as a custom tag using a CFTag or cfscript


    <cfdump var="#thisTag#">
    <!--- this should return TRUE; works in ACF 2016-2025 and Lucee 5-7 --->
    <div>isdefined() should return TRUE; works in ACF 2016-2025 and Lucee 5-7</div>
    <cfdump var="#isdefined('thisTag.executionMode')#">
    <cfdump var="#isdefined('thisTag.hasEndTag')#">

    <!--- this returns TRUE --->
    <div>structkeyexists() returns TRUE</div>
    <cfdump var="#structkeyexists(thisTag, 'executionMode')#">
    <cfdump var="#structkeyexists(thisTag, 'hasEndTag')#">

    <!--- if thisTag scope is duplicated, isdefined() works --->
    <div>if thisTag scope is duplicated, isdefined() works</div>
    <cfset t = duplicate(thisTag)>
    <cfdump var="#isdefined('t.executionMode')#">
    <cfdump var="#isdefined('t.hasEndTag')#">
  4. JamoCA created this gist Nov 9, 2025.
    33 changes: 33 additions & 0 deletions TestCustomTag.cfm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    <!---
    11/8/2025 19:45:05
    Custom Tag "thisTag" scope test.
    Call this as a custom tag using a CFTag or cfscript
    <cf_TestCustomTag>
    or
    cf_TestCustomTag();
    --->


    <cfdump var="#thisTag#">
    <!--- this should return TRUE; works in ACF 2016-2025 and Lucee 5-7 --->
    <cfdump var="#isdefined('thisTag.executionMode')#">
    <cfdump var="#isdefined('thisTag.hasEndTag')#">

    <!--- this returns TRUE --->
    <cfdump var="#structkeyexists(thisTag, 'executionMode')#">
    <cfdump var="#structkeyexists(thisTag, 'hasEndTag')#">

    <!--- if thisTag scope is duplicated, isdefined() works --->
    <cfset t = duplicate(thisTag)>
    <cfdump var="#isdefined('t.executionMode')#">
    <cfdump var="#isdefined('t.hasEndTag')#">

    <cftry>
    <cfdump var="#thisComponent#">
    <cfdump var="#isdefined('thisComponent.executionMode')#">
    <cfdump var="#isdefined('thisComponent.hasEndTag')#">
    <cfcatch>
    <div>"thisComponent" only works in BoxLang.</div>
    </cfcatch>
    </cftry>