Patterns for comparing Web Forms control HTML output against Blazor component output using Playwright
55
45%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.squad/skills/webforms-html-audit/SKILL.mdWhen migrating ASP.NET Web Forms controls to Blazor components, HTML output fidelity is critical — existing CSS and JavaScript targeting the original HTML structure must continue to work. Automated comparison of rendered HTML between Web Forms and Blazor requires careful normalization to avoid false positives from framework infrastructure differences.
Wrap Web Forms controls in sample pages with unique marker elements to enable programmatic extraction of just the control's structural HTML:
<!-- In the .aspx sample page -->
<div data-audit-control="Button" data-audit-id="styled-button">
<asp:Button runat="server" ID="styleButton" BackColor="Blue" Text="Blue Button" />
</div>Use data-audit-control and data-audit-id attributes rather than <hr> elements — they're invisible to the user, semantically clear, and easy to query via Playwright's page.locator('[data-audit-control="Button"]').innerHTML().
Before comparing Web Forms HTML against Blazor HTML, apply these normalizations:
ctl00_MainContent_X naming-container IDs. Either strip entirely or normalize to just the control's local ID.href="javascript:__doPostBack('...','...')" with a placeholder like href="#postback". Blazor uses its own event mechanism.src="/WebResource.axd?d=...&t=..." with a normalized placeholder like src="[framework-resource]".<input type="hidden" name="__VIEWSTATE" ...> and <input type="hidden" name="__EVENTVALIDATION" ...>.<script> blocks with framework data. These have no Blazor equivalent.Not all controls are equally suitable for automated HTML comparison:
<input>, Label→<span>, Image→<img>, HyperLink→<a>). Near-exact match expected.<table>, DataList→<table>, Calendar→<table>). Match expected after normalization.Maintain a registry of deliberate HTML differences between Web Forms and Blazor. Each entry should include:
__doPostBack from a Blazor component.ctl00$MainContent$ prefix is a Web Forms artifact. Blazor components should use clean IDs.data-audit-control marker9bf8669
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.