-
-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove monkey patch introduced in #1251
this is an ugly change whose only purpose is to mask the difference between libxml and nekohtml. we agreed to stop doing that a while ago and just accept that different libraries will behave different. furthermore, it caused a stack overflow while parding documents with a TD element that doesn't have any parents in #1501 fixes #1501
- Loading branch information
Showing
2 changed files
with
21 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ | |
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.cyberneko.html.HTMLElements; | ||
import org.jruby.Ruby; | ||
import org.jruby.RubyArray; | ||
import org.jruby.RubyClass; | ||
|
@@ -54,24 +53,6 @@ | |
* @author Yoko Harada <[email protected]> | ||
*/ | ||
public class NokogiriService implements BasicLibraryService { | ||
|
||
// nekohtml from version 1.9.13 they autocomplete tbody around | ||
// tr tags of a table - http://sourceforge.net/p/nekohtml/code/241/ | ||
// this monkey patch undoes this autocompletion | ||
static class MonkeyPatchHTMLElements extends HTMLElements { | ||
static void patchIt() { | ||
Element[] array = ELEMENTS_ARRAY['T'-'A']; | ||
for(int i = 0; i < array.length; i++) { | ||
if (array[i].name.equals("TR")) { | ||
array[i] = new Element(TR, "TR", Element.BLOCK, TABLE, new short[]{TD,TH,TR,COLGROUP,DIV}); | ||
} | ||
} | ||
} | ||
} | ||
static { | ||
MonkeyPatchHTMLElements.patchIt(); | ||
} | ||
|
||
public boolean basicLoad(Ruby ruby) { | ||
init(ruby); | ||
return true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters