-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed handling absent href attribute in base tag
The HTML5 spec states that the href attribute is optional for the base tag. Fixed the DomCrawler::addHtmlContent() method to support this See here and here: http://www.w3.org/TR/html-markup/base.html#base.attrs.href http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-base-element
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 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
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 |
---|---|---|
|
@@ -80,6 +80,18 @@ public function testAddHtmlContentCharset() | |
$this->assertEquals('Tiếng Việt', $crawler->filterXPath('//div')->text()); | ||
} | ||
|
||
/** | ||
This comment has been minimized.
Sorry, something went wrong.
staabm
Contributor
|
||
* @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent | ||
*/ | ||
public function testAddHtmlContentInvalidBaseTag() | ||
{ | ||
$crawler = new Crawler(null, 'http://symfony.com'); | ||
|
||
$crawler->addHtmlContent('<html><head><base target="_top"></head><a href="/contact"></a></html>', 'UTF-8'); | ||
|
||
$this->assertEquals('http://symfony.com/contact', current($crawler->filterXPath('//a')->links())->getUri(), '->addHtmlContent() correctly handles a non-existent base tag href attribute'); | ||
} | ||
|
||
/** | ||
* @covers Symfony\Component\DomCrawler\Crawler::addHtmlContent | ||
*/ | ||
|
Would't just
!empty
work already?