Support inline CSS and JavaScript #839

Closed
GoogleCodeExporter opened this Issue Mar 25, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@GoogleCodeExporter
What steps will reproduce the problem?
1.In your updateRoot: method for a component that is rendered using Seaside 
REST add

htmlRoot addStyle:'body{font-size:12px;}'.

2. Load the component 



What is the expected output? What do you see instead?

The page should render.  


An error is thrown when the 

WARenderContext>>#urlForDocument:mimeType:fileName:

methods is run.  


What version of the product are you using? On what operating system?

Seaside 3.1.3  
Please provide any additional information below.

Original issue reported on code.google.com by pdebr...@gmail.com on 21 Feb 2015 at 10:11

@marschall marschall self-assigned this Jul 17, 2015

@marschall marschall changed the title from sending #addStyle: to an htmlRoot when rending using Seaside REST results in an error because there is no session to Support inline CSS and JavaScript Jul 17, 2015

@marschall marschall removed their assignment Jul 17, 2015

@marschall

This comment has been minimized.

Show comment
Hide comment
@marschall

marschall Jul 17, 2015

The issue is the following:
Currently we do not allow inline CSS or JavaScript content (unless you subclass WAHtmlElement). Every CSS and JavaScript you add the root ends up as a document handler in the session. This obviously doesn't work when you don't have a session. It also hurts you when you want to go for maximum points on PageSpeed Insights. I see two possible ways forward:

  1. Add checks to WAContentElement and WAHtmlRoot and check whether we have a session.
  2. Add an additional method to WAContentElement for setting the inline content

I'm leaning towards the second one.

The issue is the following:
Currently we do not allow inline CSS or JavaScript content (unless you subclass WAHtmlElement). Every CSS and JavaScript you add the root ends up as a document handler in the session. This obviously doesn't work when you don't have a session. It also hurts you when you want to go for maximum points on PageSpeed Insights. I see two possible ways forward:

  1. Add checks to WAContentElement and WAHtmlRoot and check whether we have a session.
  2. Add an additional method to WAContentElement for setting the inline content

I'm leaning towards the second one.

@marschall

This comment has been minimized.

Show comment
Hide comment
@marschall

marschall Jul 19, 2015

@pdebruic the following should work but is arguably not the best API

    htmlRoot stylesheet add: 'body{font-size:12px;}'.
    htmlRoot javascript add: 'alert("loaded")'

@pdebruic the following should work but is arguably not the best API

    htmlRoot stylesheet add: 'body{font-size:12px;}'.
    htmlRoot javascript add: 'alert("loaded")'

@marschall marschall self-assigned this Aug 21, 2016

@marschall marschall added this to the 3.3 milestone Aug 21, 2016

@marschall

This comment has been minimized.

Show comment
Hide comment
@marschall

marschall Aug 21, 2016

Syntax is

root style: 'body{font-size:12px;}'

You'll get a <style>-element instead of a <link>-element. See WARootFunctionalTest.

Name: Seaside-Core-pmm.870
Author: pmm
Time: 21 August 2016, 2:47:15.665168 pm
UUID: d3dcb892-e562-4819-a5ad-5c8ea4126bbd
Ancestors: Seaside-Core-JohanBrichau.869

Support inline CSS and JavaScript #839

Name: Seaside-Tests-Canvas-pmm.70
Author: pmm
Time: 21 August 2016, 2:49:07.168455 pm
UUID: 37dc5ab3-9f47-42a2-a302-a71dc5991a1d
Ancestors: Seaside-Tests-Canvas-pmm.69

Support inline CSS and JavaScript #839

Name: Seaside-Tests-Functional-pmm.169
Author: pmm
Time: 21 August 2016, 2:50:08.922968 pm
UUID: 5128a2c9-6e19-416e-ba8f-da355a400df2
Ancestors: Seaside-Tests-Functional-JohanBrichau.168

Support inline CSS and JavaScript #839

Syntax is

root style: 'body{font-size:12px;}'

You'll get a <style>-element instead of a <link>-element. See WARootFunctionalTest.

Name: Seaside-Core-pmm.870
Author: pmm
Time: 21 August 2016, 2:47:15.665168 pm
UUID: d3dcb892-e562-4819-a5ad-5c8ea4126bbd
Ancestors: Seaside-Core-JohanBrichau.869

Support inline CSS and JavaScript #839

Name: Seaside-Tests-Canvas-pmm.70
Author: pmm
Time: 21 August 2016, 2:49:07.168455 pm
UUID: 37dc5ab3-9f47-42a2-a302-a71dc5991a1d
Ancestors: Seaside-Tests-Canvas-pmm.69

Support inline CSS and JavaScript #839

Name: Seaside-Tests-Functional-pmm.169
Author: pmm
Time: 21 August 2016, 2:50:08.922968 pm
UUID: 5128a2c9-6e19-416e-ba8f-da355a400df2
Ancestors: Seaside-Tests-Functional-JohanBrichau.168

Support inline CSS and JavaScript #839

@marschall marschall closed this Aug 21, 2016

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