Fix Unicode bug

Fix Diego Restrepo's bug (see Rev 184).
Update to latest HTML5lib.
This commit is contained in:
Jacques Distler 2007-12-17 03:17:43 -06:00
parent 18da1a1d71
commit 0f6889e09f
29 changed files with 380 additions and 498 deletions

View file

@ -25,7 +25,7 @@ module HTML5
def endTagHtml(name)
if @parser.inner_html
parse_error
parse_error "end-html-in-innerhtml"
else
# XXX: This may need to be done, not sure
# Don't set last_phase to the current phase but to the inBody phase

View file

@ -51,34 +51,22 @@ module HTML5
super(parser, tree)
# for special handling of whitespace in <pre>
if $-w
$-w = false
class << self; alias processSpaceCharactersNonPre processSpaceCharacters; end
$-w = true
else
class << self; alias processSpaceCharactersNonPre processSpaceCharacters; end
silence do
class << self
alias processSpaceCharactersNonPre processSpaceCharacters
end
end
end
def processSpaceCharactersDropNewline(data)
# #Sometimes (start of <pre> blocks) we want to drop leading newlines
if $-w
$-w = false
class << self
silence do
alias processSpaceCharacters processSpaceCharactersNonPre
end
end
$-w = true
else
class << self
silence do
alias processSpaceCharacters processSpaceCharactersNonPre
end
class << self
silence do
alias processSpaceCharacters processSpaceCharactersNonPre
end
end
if (data.length > 0 and data[0] == ?\n &&
%w[pre textarea].include?(@tree.open_elements.last.name) && !@tree.open_elements.last.hasContent)
data = data[1..-1]
@ -376,16 +364,6 @@ module HTML5
end
def endTagBlock(name)
#Put us back in the right whitespace handling mode
if name == 'pre'
class << self;
silence do
alias processSpaceCharacters processSpaceCharactersNonPre;
end
end
end
@tree.generateImpliedEndTags if in_scope?(name)
unless @tree.open_elements.last.name == name

View file

@ -144,7 +144,7 @@ module HTML5
def remove_open_elements_until(name=nil)
finished = false
until finished
until finished || @tree.open_elements.length == 0
element = @tree.open_elements.pop
finished = name.nil? ? yield(element) : element.name == name
end