コード例 #1
0
 /**
  * @group GlobalFunctions
  */
 public function testFunctionWithContent()
 {
     $dom = new DOMDocument();
     $node = $dom->appendChild($dom->createElement('html'));
     $fd = FluentDOMStyle($node);
     $this->assertTrue($fd instanceof FluentDOMStyle);
     $this->assertEquals('html', $fd->document->documentElement->nodeName);
 }
コード例 #2
0
ファイル: css-unset.php プロジェクト: noels/FluentDOM
<?php

/**
* Example file for property 'css'
*
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @copyright Copyright (c) 2010 Bastian Feder, Thomas Weinert
*/
header('Content-type: text/plain');
$html = <<<HTML
<html>
 <head>
  <title>FluentDOM project page</title>
 </head>
 <body>
  <p style="color: red;">
   Always nice to visit
   <a href='http://fluentdom.org' style='color: red; font-weight: bold; text-decoration: none;'>here</a> or
   <a href='http://github.org/FluentDOM' style='color: blue; text-decoration: none;'>here.</a>
  </p>
 </body>
</html>
HTML;
echo "Example for property 'css' - remove properties:\n\n";
require_once '../../src/FluentDOM/Style.php';
$fd = FluentDOMStyle($html, 'text/html')->find('/html/body//*');
unset($fd->css[array('color', 'font-weight')]);
echo (string) $fd;
コード例 #3
0
ファイル: css-get.php プロジェクト: noels/FluentDOM
<?php

/**
* Example file for property 'attr'
*
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @copyright Copyright (c) 2010 Bastian Feder, Thomas Weinert
*/
header('Content-type: text/plain');
$html = <<<HTML
<html>
 <head>
  <title>FluentDOM project page</title>
 </head>
 <body>
  <p>
   Always nice to visit
   <a href='http://fluentdom.org' style="color: red;">here</a> or
   <a href='http://github.org/FluentDOM' style="color: blue;">here.</a>
  </p>
 </body>
</html>
HTML;
echo "Example for property 'css' - reading color:\n\n";
require_once '../../src/FluentDOM/Style.php';
$fd = FluentDOM($html, 'text/html')->find('//a');
foreach ($fd as $node) {
    $fdNode = FluentDOMStyle($node);
    echo $fdNode->css['color'], "\n";
}
コード例 #4
0
ファイル: css-set.php プロジェクト: noels/FluentDOM
<?php

/**
* Example file for property 'css'
*
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @copyright Copyright (c) 2010 Bastian Feder, Thomas Weinert
*/
header('Content-type: text/plain');
$html = <<<HTML
<html>
 <head>
  <title>FluentDOM project page</title>
 </head>
 <body>
  <p>
   Always nice to visit
   <a href='http://fluentdom.org'>here</a> or
   <a href='http://github.org/FluentDOM'>here.</a>
  </p>
 </body>
</html>
HTML;
echo "Example for property 'css'- setting text-decoration:\n\n";
require_once '../../src/FluentDOM/Style.php';
$fd = FluentDOMStyle($html, 'text/html');
$fd->find('//a')->css['text-decoration'] = 'none';
echo (string) $fd;