[Seaside-dev] WAStyleElement

John Thornborrow john at pinesoft.co.uk
Wed Sep 19 17:04:26 UTC 2007


Hello All,

I've created a style tag element class, specifically for use within a
context such as:

#updateRoot: aRoot
  aRoot if ie6; do: [| style |
    style := (WAStyleElement root: aRoot) beCss.
    style contents: 'body { margin: 0pt; padding: 0pt;}'.
    aRoot add: style
  ]
  ^super updateRoot: aRoot

Which allows myself to battle the box model errors (amongst others) with
more ease.

I thought I would send a fileOut rather than save into Monticello as I
do not have a "pure" installation at hand, and like the last time I
saved, there would be some extras I did not intent to add. Anyway..

Attached is the class, I have stuck to the w3 standards as best as I can
interpret.

Regards,
John



Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA



This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com

-------------- next part --------------
'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 19 September 2007 at 5:52:08 pm'!
WAHtmlElement subclass: #WAStyleElement
	instanceVariableNames: 'content'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Seaside-Document-Elements'!

!WAStyleElement methodsFor: 'attributes' stamp: 'jmt 9/19/2007 17:38'!
contents: aString
	content := aString! !

!WAStyleElement methodsFor: 'attributes' stamp: 'jmt 9/19/2007 17:47'!
media: aMedia
	self attributeAt: 'media' put: aMedia! !

!WAStyleElement methodsFor: 'attributes' stamp: 'jmt 9/19/2007 17:37'!
type: aType
	self attributeAt: 'type' put: aType! !


!WAStyleElement methodsFor: 'types' stamp: 'jmt 8/14/2007 10:54'!
beCss
	^self type: 'text/css'! !


!WAStyleElement methodsFor: 'testing' stamp: 'jmt 9/19/2007 17:47'!
isClosed
	^false! !


!WAStyleElement methodsFor: 'printing' stamp: 'jmt 9/19/2007 17:47'!
encodeOn: aDocument
	aDocument openTag: self tag attributes: attributes closed: self isClosed.
	self isClosed ifTrue: [ ^ self ].
	aDocument nextPutAll: content.
	self childrenDo: [ :each | each encodeOn: aDocument ].
	aDocument closeTag: self tag! !


!WAStyleElement methodsFor: 'accessing' stamp: 'jmt 7/30/2007 15:39'!
tag
	^'style'! !


More information about the seaside-dev mailing list