Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat target="_self" the same as being empty #818

Merged
merged 147 commits into from
Feb 22, 2022
Merged

Treat target="_self" the same as being empty #818

merged 147 commits into from
Feb 22, 2022

Conversation

mauricioarangoosorio
Copy link

@mauricioarangoosorio mauricioarangoosorio commented Feb 13, 2022

HI, just run into this issue and propose not to ignore anchors with the target="_self" attribute.

If I'm writing templates I have control on what attributes I add. But if the code is generated by something else, for example, a text editor on a CMS, I don't have control on such attributes. target='_self' is a standard and just tell us to load the page on the same browser window. Therefore I don't think an anchor with such attribute should be ignored by HTMX.

With Htmx 1.6.1 now I have to write an additional little routine to scrap the content of target. So it seems a little clunky.


UPDATE


I tested on HTMX 1.7.0 and the issue still persists.

jreviews and others added 30 commits October 21, 2020 06:55
- rebuilding this fork because of a corrupted git repository.  This branch is "working" but needs more testing to be certain.
- major changes to the way that htmx handles extensions.  this will need to be vetted more carefully before we proceed.
- multichannel test works well.
- removing debug code from simple SSE example
- to remove some pesky typescript errors/warnings
- trigger tests working.
- settle tests failing
- nothing works.
- moving api reference from a function argument into the init() constructor
- Only adding JSDoc comments for functions that are useful for troubleshooting / validating the extension work.  More thorough comments to come later.
"api" reference moved from function calls into the new "init" constructor.
- just checking in progress... no tests tested.  I have no idea if this code works or not yet. (so assume it's still a dumpster fire)
- internal API has been moved to a constructor variable.
- added reconnect with exponential backoff
- initial tests of SSE features are working
- added many JSDoc comments in the process.
- added link to "sse triggers" test
Updating this (in-progress) extension to us the init constructor
- removing more SSE boilerplate from WS extension.
- additional Typescript definitions to help analyze/migrate existing WebSocket code.
- no code changes (except additions to internal api)
- removing more SSE boilerplate in favor of real WebSocket code
- starting to implement "ws-connect" attribute.
- nothing works yet.  Do Not Use.
- new methods added to internal API
- sort HtmxInternalApi
- wire up new functions into internal API
- remove duplicate functions
…ed CSPs to still work with the new script insertion method.
- these functions are (currently) needed by the WebSocket extension.  This may be cleaned up in the future once we are more confident with this architecture.
rebuild navigation and stylesheet for test pages.
playing with code coloring
carson and others added 27 commits February 17, 2022 06:30
Demo code:

```html
<form hx-post="/form?token=123" hx-target="#result">
    <input name="name" value="John Smith" />
    <select name="role">
        <option selected value="admin">Admin</option>
        <option selected value="author">Author</option>
        <option selected value="guest">Guest</option>
    </select>
    <button type="submit">Submit</button> 
</form>

<output id="result"></output>

<template url="/form">
    <div>${JSON.stringify(params)}</div>
</template>
```
* load htmx and hyperscript after mock-request, so you can use `init` and `load` correctly
* disable all disableable elements while the demo environment is loading
* support a `delay` attribute on templates to specify a delay
* merged @dz4k's excellent simplification to the eval code
@mauricioarangoosorio
Copy link
Author


UPDATE


I tested on HTMX 1.7.0 and the issue still persists, anchors with the target='_self' attribute are ignored by HTMX.

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.