Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Requiring Enhance #8

Closed
peterpme opened this issue Jan 6, 2015 · 4 comments
Closed

Requiring Enhance #8

peterpme opened this issue Jan 6, 2015 · 4 comments

Comments

@peterpme
Copy link

peterpme commented Jan 6, 2015

Please correct me if I'm wrong, but it looks like this is necessary for politespace to work:

<script>
    jQuery( function(){
        jQuery( document ).trigger( "enhance" );
    });
</script>

I pulled the demo and removed this and it all stopped working. It is not documented either. Can you tell me more about what it does?

Thank you

@jefflembeck
Copy link
Collaborator

There is an event listener bound to the document for the enhance event in order to initialize politespace. - https://github.com/filamentgroup/politespace/blob/master/src/politespace-init.js#L28

@zachleat
Copy link
Member

zachleat commented Jan 7, 2015

We use this event to initialize both when the document first loads and when any new content is included with XMLHTTPRequest (such as with our AjaxInclude plugin). Many Filament Group plugins use this convention.

Please reopen if you have additional questions!

@zachleat zachleat closed this as completed Jan 7, 2015
@localjo
Copy link

localjo commented Jul 1, 2015

It took me about an hour to figure out why politespace was not working for me. I was unfamiliar with the enhance event convention, and though I found this issue, I was trying to imitate the demo, and I had added a data-enhanced attribute to my input which prevented politespace from initializing. I think it would be useful to mention this in the usage section of the readme, maybe with a link to more info about the convention.

@MattSnowOregonGov
Copy link

@josiahsprague THANK YOU. That was super unclear. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants