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

Allow Scripts and Styles in all Response Locations #24

Closed
nicksay opened this issue Jul 22, 2014 · 2 comments · Fixed by #96
Closed

Allow Scripts and Styles in all Response Locations #24

nicksay opened this issue Jul 22, 2014 · 2 comments · Fixed by #96

Comments

@nicksay
Copy link
Contributor

nicksay commented Jul 22, 2014

Allow Scripts and Styles in all Response Locations

Current

Response processing is currently:

  1. title — Update document title
  2. url — Update document url
  3. css — Install page-wide styles
  4. attr — Set element attributes
  5. html — Set element content and install element scripts (styles handled by browser).
  6. js — Install page-wide scripts

Issue

In a standard response, styles and scripts can be placed anywhere. In the current SPF response, styles cannot be placed in the foot and scripts cannot be place in the head. While this generally "best practice", executing scripts early is also a common need (e.g. async script loading, google analytics, web font loading, etc). The current SPF behavior diverges from standard behavior, which is unexpected.

Proposal

To make this more uniform, update processing to install page-wide scripts and styles in both steps 3 and 6. To make this more clear, rename css to head, html to body, and js to foot. Response processing would then be:

  1. title — Update document title
  2. url — Update document url
  3. head — Install early page-wide scripts and styles
  4. attr — Set element attributes
  5. body — Set element content and install element scripts and styles
  6. foot — Install late page-wide scripts and styles

Also, whereas before we let the browser automatically install and uninstall styles that occur in body fragments, since scripts are not natively supported, we parse and execute them. This activates SPF's version handling and execution logic for scripts, whereas styles don't get this. Make this consistent by treating styles in body fragments in the same way as we would in head or foot fragments.

@nicksay nicksay added this to the SPF 20 milestone Jul 22, 2014
@nicksay
Copy link
Contributor Author

nicksay commented Jul 22, 2014

Work is already in progress on this issue and was started in 5186b2b

nicksay added a commit to nicksay/spfjs that referenced this issue Aug 2, 2014
(This was missed in 5186b2b.)

Add tests to ensure response processing for html applies to both the
new "body" field and the deprecated "html" field.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 2, 2014
(This was missed in 5186b2b.)

Add tests to ensure response processing for html applies to both the
new `body` field and the deprecated `html` field.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 2, 2014
Instead of having two methods for parsing scripts and styles, consolidate
them.  This also unifies the parse result object, which will allow
installation of scripts and styles from any fragment in the future.

Make the parsing logic much more robust, handling both HTML4 and HTML5 styles,
as well as oddities like spaces and single quotes.

For now, guard using the new method behind a `experimental-extract-unified`
config.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 2, 2014
Instead of having two methods for parsing scripts and styles, consolidate
them.  This also unifies the parse result object, which will allow
installation of scripts and styles from any fragment in the future.  For now,
guard the new method behind a `experimental-extract-unified` config.

Also, make the parsing logic much more robust, handling both HTML4 and HTML5
formats, as well as oddities like spaces and single quotes.  Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 2, 2014
Instead of having two methods for parsing scripts and styles, consolidate
them.  This also unifies the parse result object, which will allow
installation of scripts and styles from any fragment in the future.  For now,
guard the new method behind a `experimental-extract-unified` config.

Also, make the parsing logic much more robust, handling both HTML4 and HTML5
formats, as well as oddities like spaces and single quotes.  Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 5, 2014
Instead of having two methods for parsing scripts and styles, consolidate
them.  This also unifies the parse result object, which will allow
installation of scripts and styles from any fragment in the future.  For now,
guard the new method behind a `experimental-extract-unified` config.

Also, make the parsing logic much more robust, handling both HTML4 and HTML5
formats, as well as oddities like spaces and single quotes.  Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 5, 2014
Instead of having two methods for parsing scripts and styles, consolidate
them.  This also unifies the parse result object, which will allow
installation of scripts and styles from any fragment in the future.  For now,
guard the new method behind a `experimental-extract-unified` config.

Also, make the parsing logic much more robust, handling both HTML4 and HTML5
formats, as well as oddities like spaces and single quotes.  Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 5, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 5, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 5, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 13, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 13, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 13, 2014
- Consolidate parsing scripts and styles from two methods to one.
- Unify the parse result object for scripts and styles.
- Parse and install scripts and styles from all fragments.
- For now, guard behind a `experimental-extract-unified` config.
- Improve parsing logic, handling HTML4/HTML5 formats and irregularities.
- Add tests.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 19, 2014
nicksay added a commit to nicksay/spfjs that referenced this issue Aug 21, 2014
The response key was removed in c20d48c.

Progress on youtube#24.
nicksay added a commit to nicksay/spfjs that referenced this issue Sep 29, 2014
@nicksay
Copy link
Contributor Author

nicksay commented Sep 29, 2014

Now that #91 is merged, this issues is almost closed!

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

Successfully merging a pull request may close this issue.

1 participant