@@ -43,7 +43,7 @@ def startswithany(str, prefixes):
4343from constants import scopingElements ,formattingElements ,specialElements
4444from constants import headingElements ,tableInsertModeElements
4545from constants import cdataElements ,rcdataElements ,voidElements
46- from constants import tokenTypes ,ReparseException ,namespaces
46+ from constants import tokenTypes ,ReparseException ,namespaces , spaceCharacters
4747
4848def parse (doc ,treebuilder = "simpletree" ,encoding = None ,
4949namespaceHTMLElements = True ):
@@ -977,7 +977,11 @@ def processSpaceCharactersDropNewline(self, token):
977977def processCharacters (self ,token ):
978978self .tree .reconstructActiveFormattingElements ()
979979self .tree .insertText (token ["data" ])
980- self .parser .framesetOK = False
980+ #This must be bad for performance
981+ if (self .parser .framesetOK and
982+ any ([char not in set (u"\ufffd " )| spaceCharacters
983+ for char in token ["data" ]])):
984+ self .parser .framesetOK = False
981985
982986def processSpaceCharacters (self ,token ):
983987self .tree .reconstructActiveFormattingElements ()