A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mail-archive.com/html5lib-discuss@googlegroups.com/msg00284.html below:

Implementing r2732 (revised foster-parent definition)

Hi all,

I have a problem. I tried implementing r2732 [1] (see attached patch)
but I'm facing what looks like a bug but I'm not sure...
After applying the attached patch, the following tests fail while they
didn't before:
tests1_103: <a><table><td><a><table></table><a></tr><a></table><a>
tests1_30:  <a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y
tests1_78:  <a href="blah">aba<table><a
href="foo">br<tr><td></td></tr>x</table>aoe
tests1_90:  <a><table><a></table><p><a><div><a>

The first of these failing tests have the following details:
FAIL: test_tests1_103_simpletree (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_parser.py", line 135, in testFunc
    return self.runParserTest(innerHTML, input, expected, errors, treeCls)
  File "test_parser.py", line 104, in runParserTest
    self.assertEquals(expected, output, errorMsg)
AssertionError:

Input:
<a><table><td><a><table></table><a></tr><a></table><a>

Expected:
<html>
  <head>
  <body>
    <a>
      <a>
      <table>
        <tbody>
          <tr>
            <td>
              <a>
                <table>
              <a>
    <a>

Received:
<html>
  <head>
  <body>
    <a>
      <table>
        <tbody>
          <tr>
            <td>
              <a>
                <table>
              <a>
    <a>
  <a>

I tried adding the following line just before the "if" with the same
conditions (as I suspect this is the case here that the test evaluates
to True):
assert lastTable.parent == fosterParent, "lastTable.parent: %s,
fosterParent: %s" % (lastTable.parent, fosterParent)
The test now fails with:
AssertionError: lastTable.parent: <a>, fosterParent: <body>
while I would have thought fosterParent had been <a> too.

In other words, it seems the stack of open elements doesn't contain
the <a> between the <body> and <table>.


I give up there, as foster parenting is not something I'm familiar
with. I hope the attached patch will help others fix html5lib (or the
tests?)

[1] http://html5.org/tools/web-apps-tracker?from=2731&to=2732

-- 
Thomas Broyer

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"html5lib-discuss" group.
 To post to this group, send email to html5lib-discuss@googlegroups.com
 To unsubscribe from this group, send email to 
html5lib-discuss+unsubscr...@googlegroups.com
 For more options, visit this group at 
http://groups.google.com/group/html5lib-discuss?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

html5-r2732.patch
Description: Binary data


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4