Skip to content

Commit

Permalink
Merge pull request #102 from SWTI2014/parsing/CSS-@rule
Browse files Browse the repository at this point in the history
Fix #80, Fix #81: Nil selector and unknown CSS-@rules
  • Loading branch information
PFischbeck committed Jun 16, 2014
2 parents d05bcde + d173b10 commit e8d86ad
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 8 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
} }
14 changes: 14 additions & 0 deletions packages/HTML.package/CSSAtIgnoreRule.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "HTML-CSS",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "CSSAtIgnoreRule",
"pools" : [
],
"super" : "CSSAtRule",
"type" : "normal" }
3 changes: 2 additions & 1 deletion packages/HTML.package/CSSAtRule.class/class/named..st
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ named: aString
out nextPutAll: 'Rule'.

cls := Smalltalk at: out contents asSymbol ifAbsent:[nil].


cls ifNil: [^CSSAtIgnoreRule new.].
^cls new.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"class" : {
"named:" : "tb 1/6/2006 09:46" },
"named:" : "SS 6/15/2014 11:28" },
"instance" : {
"parseContents:" : "tb 1/3/2006 17:03" } }
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ oneSelectorFromString: aString
sel selectors isEmpty
ifFalse: [sel addSelector: comb]
ifTrue: [sel := comb].
comb addSelector: (self oneSelectorFromString: in upToEnd)
in atEnd ifFalse:
[comb addSelector: (self oneSelectorFromString: in upToEnd)].
]
]
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"class" : {
"fromString:" : "tb 4/8/2006 20:45",
"oneSelectorFromString:" : "tb 4/8/2006 20:45" },
"oneSelectorFromString:" : "SS 6/15/2014 13:06" },
"instance" : {
"isAdjacentSelector" : "tb 12/21/2005 12:40",
"isAttributeSelector" : "tb 1/3/2006 04:55",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
test01CSSSelectorWihtoutNilSelector

| selector |
selector := CSSSelector fromString: 'yt-uix-button img,.yt-uix-button-icon-wrapper+.yt-uix-button-content'.
self assert: selector asString equals: 'yt-uix-button img , *.yt-uix-button-icon-wrapper+*.yt-uix-button-content '.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
test02CSSAtRuleStartingWithDashShouldNotRaiseErrors

self shouldnt: [CSSAtRule named: '-ignore'] raise: MessageNotUnderstood.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"class" : {
},
"instance" : {
"test01CSSSelectorWihtoutNilSelector" : "SS 6/15/2014 13:36",
"test02CSSAtRuleStartingWithDashShouldNotRaiseErrors" : "SS 6/15/2014 17:29" } }
14 changes: 14 additions & 0 deletions packages/HTML.package/CSSSelectorTest.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "HTML-CSS-Tests",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"colorFormatter" ],
"name" : "CSSSelectorTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ parseAtRule: aStream media: anArray
s := aStream position.
aStream next.
aStream skipSeparators.
aStream peek isLetter
ifTrue: [label nextPut: aStream next]
ifFalse: [self halt].

[aStream peek isLetter or: [aStream peek isDigit or:['-_' includes: aStream peek]]]
whileTrue: [label nextPut: aStream next].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"isStyleSheet" : "tb 12/17/2005 22:25",
"loadStyles" : "js 6/5/2014 14:58",
"media" : "tb 12/30/2005 14:50",
"parseAtRule:media:" : "tb 1/6/2006 09:43",
"parseAtRule:media:" : "SS 6/15/2014 11:27",
"parseContents:" : "tb 1/3/2006 17:04",
"parseStyles:media:" : "js 6/1/2014 13:44",
"tag" : "tb 12/20/2005 13:17",
Expand Down

0 comments on commit e8d86ad

Please sign in to comment.