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

Global pat-inject #703

Open
cornae opened this issue Feb 27, 2020 · 3 comments
Open

Global pat-inject #703

cornae opened this issue Feb 27, 2020 · 3 comments
Assignees

Comments

@cornae
Copy link
Member

cornae commented Feb 27, 2020

Context

In the beginning when the web was void and empty we used a pat-inject statement here and there to smoothen things up. Today I fill my days writing class="pat-inject" data-pat-inject="history: record" on every possible link. History: record is something that we want almost every time.

Problem

We could make it a default and have history: no-record for the exceptions. But the pat-inject class is still needed on every link and form which is a lot of work. Also we have no control over links in rich texts written by editors. And those should use inject too for smooth operation of applications such as Quaive.

Proposal

I propose to introduce a 'selector' property for pat-inject. The selector property allow for pointing to the element(s) on which the inject statement should take effect. The default value is 'self' like it is now. The selector would within the context of the container element the statement is placed on.

Example:

<body class="pat-inject" 
      data-pat-inject="selector: a,form; source: #main; target: #main; history: record">

The above example would apply basic injection behaviour for everthing that loads content on the site.

It should be possible to overrule the inject statement. For instance when an injection is sometimes not desired or when another combination of source and target is desired.

To a designer it would feel natural to overrule property by property. But I think that would be too complex. I would propose to overrule pat-inject on a link or form element altogether simply by putting a class pat-inject on the element. It will accept only its own properties.

When no injection is required on an element that matches the pat-inject selector of its container, I propose the following: class="pat-inject" data-pat-inject="none".

@cornae
Copy link
Member Author

cornae commented Feb 27, 2020

Note: the current pat-inject documentation mentions that a property 'selector' already exists, but I think that that's a typo and that that should be 'source'.

@thet
Copy link
Member

thet commented May 21, 2020

I like the global injection idea.
The selector documentation is a typo (fixed in PR #724) but there is really also a selector property which can be defined as default if no source and target are defined (renamed in PR #724).
I'm not sure if renaming the selector property to defaultSelector won't break things...

@cornae
Copy link
Member Author

cornae commented Aug 21, 2020

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

No branches or pull requests

3 participants