'From Squeak3.7alpha of ''11 September 2003'' [latest update: #5526] on 7 November 2003 at 11:27:15 pm'! "Change Set: ScamperTagParsing Date: 7 November 2003 Author: Frank Shearar This changeset corrects the mis-parsing of empty tags like 'p /' as an HtmlTag with name 'p' followed by text '/>' by skipping over the trailing spaces."! TestCase subclass: #HtmlTokenizerTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Tests-Network-Web Browser'! !HtmlTokenizer methodsFor: 'private-tokenizing' stamp: 'FBS 11/7/2003 23:13'! nextTag "we've seen a < and peek-ed something other than a !!. Parse and return a tag" | source negated name attribs attribName attribValue sourceStart sourceEnd c | sourceStart _ pos-1. attribs _ Dictionary new. "determine if its negated" self peekChar = $/ ifTrue: [ negated _ true. self nextChar. ] ifFalse: [ negated _ false ]. "read in the name" self skipSpaces. name _ self nextName. name _ name asLowercase. "read in any attributes" [ self skipSpaces. c _ self peekChar. c = nil or: [c isLetter not ] ] whileFalse: [ attribName _ self nextName. attribName _ attribName asLowercase. self skipSpaces. self peekChar = $= ifTrue: [ self nextChar. self skipSpaces. attribValue _ self nextAttributeValue withoutQuoting ] ifFalse: [ attribValue _ '' ]. attribs at: attribName put: attribValue ]. self skipSpaces. self peekChar = $/ ifTrue: [ self nextChar ]. self peekChar = $> ifTrue: [ self nextChar ]. sourceEnd _ pos-1. source _ text copyFrom: sourceStart to: sourceEnd. ^HtmlTag source: source name: name asLowercase negated: negated attribs: attribs! ! !HtmlTokenizerTest methodsFor: 'Running' stamp: 'FBS 11/7/2003 23:09'! testEmptyTag | tok tag | tok := HtmlTokenizer on: ''. tag := tok next. self assert: (tag name = 'html'). self assert: (tag isNegated not). self assert: (tok atEnd).! !