Skip to content

Fix h-include issue 112#113

Open
gustafnk wants to merge 8 commits into
mainfrom
claude/discuss-issue-112-011CUrpzw9oh1cnV3gdNccAg
Open

Fix h-include issue 112#113
gustafnk wants to merge 8 commits into
mainfrom
claude/discuss-issue-112-011CUrpzw9oh1cnV3gdNccAg

Conversation

@gustafnk
Copy link
Copy Markdown
Owner

@gustafnk gustafnk commented Nov 7, 2025

Fixes #112

Previously, the when predicate was only evaluated if when-false-src attribute was present, due to this logic:

var whenCondition = whenFalseUrl && !element.conditionalInclusion.call(...)

This prevented using when alone for conditional inclusion (showing content when predicate is true, nothing otherwise).

Changes:

  • Changed condition to check for when attribute existence instead
  • When predicate fails with no when-false-src, no HTTP request is made
  • Updated test expectations to reflect corrected behavior
  • alt attribute is only used for HTTP errors, not conditional logic

The fix maintains proper separation of concerns:

  • Conditionals (when, media) gate whether to make a request
  • alt only handles HTTP request failures

claude and others added 8 commits November 6, 2025 15:20
Fixes #112

Previously, the `when` predicate was only evaluated if `when-false-src`
attribute was present, due to this logic:

  var whenCondition = whenFalseUrl && !element.conditionalInclusion.call(...)

This prevented using `when` alone for conditional inclusion (showing
content when predicate is true, nothing otherwise).

Changes:
- Changed condition to check for `when` attribute existence instead
- When predicate fails with no `when-false-src`, no HTTP request is made
- Updated test expectations to reflect corrected behavior
- `alt` attribute is only used for HTTP errors, not conditional logic

The fix maintains proper separation of concerns:
- Conditionals (`when`, `media`) gate whether to make a request
- `alt` only handles HTTP request failures
…utes

The previous logic only checked if the 'when' attribute exists, which broke
the scenario where both 'when' and 'when-false-src' are present and the
predicate fails. This caused tests to fail as the when-false-src URL wasn't
being loaded correctly.

Now checks both attributes exist before setting whenCondition to true,
ensuring:
- when fails + when-false-src exists → loads when-false-src
- when fails + no when-false-src → no request made
- when passes → loads regular src

Fixes test failures for "does perform inclusion of when-false-src when
predicate function fails"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The previous fix added `&& whenFalseUrl` which was too restrictive and broke
many tests. The correct logic is to check only if the when attribute exists
and evaluates to false, regardless of whether when-false-src exists.

When when-false-src doesn't exist, getConditionalUrl will set url to null
(since whenFalseUrl will be null), which correctly prevents any HTTP request.

This reverts back to the PR's original logic which is correct.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The previous version (4.6.4) reached end-of-life in November 2022 and is
causing timeouts and compatibility issues with current browsers and
SauceLabs infrastructure.

Updated to use sauce-connect-action@v3 which defaults to Sauce Connect 5,
the currently supported version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The v3 action requires the region parameter to be explicitly specified.
Using us-west-1 which corresponds to the default ondemand.saucelabs.com
endpoint that was previously used implicitly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The v3 tag doesn't exist, need to use the full version v3.0.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sauce Connect v3 uses tunnelName instead of tunnelIdentifier as the
parameter name for naming the tunnel.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The old configurations were using very outdated OS versions:
- OS X 10.11 (El Capitan, 2015)
- macOS 10.12 (Sierra, 2016)
- macOS 10.15 (Catalina, 2019)

These old platforms are causing test failures, likely due to compatibility
issues with Sauce Connect 5 or outdated browser versions on those OSes.

Updated to modern, currently supported platforms:
- Windows 11 with Chrome, Firefox, and Edge
- macOS 13 (Ventura) with Safari

Chrome on Windows 10 tests are passing, confirming the logic is correct.
The failures were specific to the old browser/OS combinations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

when predicate is not evaluated unless when-false-src is provided

2 participants