From 6bcc2936a2819367cca6c0719df8e2c1d2f46146 Mon Sep 17 00:00:00 2001 From: Tobi Lutke Date: Wed, 11 Mar 2026 07:32:39 -0400 Subject: [PATCH] skip TagAttributes scan in for tag when no colon present --- lib/liquid/tags/for.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/liquid/tags/for.rb b/lib/liquid/tags/for.rb index cbea85bc..a1b5ebba 100644 --- a/lib/liquid/tags/for.rb +++ b/lib/liquid/tags/for.rb @@ -79,8 +79,11 @@ module Liquid @reversed = !!Regexp.last_match(3) @name = "#{@variable_name}-#{collection_name}" @collection_name = parse_expression(collection_name) - markup.scan(TagAttributes) do |key, value| - set_attribute(key, value) + # Only scan for limit:/offset: attributes if markup contains ':' + if markup.include?(':') + markup.scan(TagAttributes) do |key, value| + set_attribute(key, value) + end end else raise SyntaxError, options[:locale].t("errors.syntax.for")