Jump to content

new domdocument(); not preserving tags


shadiadiph

Recommended Posts

Hi I am baffled.

 

I am trying to modify some html using

$dom = new DOMDocument();
$dom->preserveWhiteSpace = true;
$dom->loadHTML($html);
$html = $dom->saveHTML();
return $html;

I have my functions already worked out the above is what I have narrowed the error down to, all the rest of my code works probelm is when it loads html and saves html it seems to change this.

prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',

to this

prevText: '<i class="fa fa-chevron-left">',
nextText: '<i class="fa fa-chevron-right">',

The rest of the document is fine just this portion changes and messes everything up.

 

The above code is javascript embedded into the code from somewhere it is a wordpress plugin.

 

When I remove the new DOMDocument(); code it works fine.

 

All the other stuff I am doing is working fine, just wondering is there anyway to fix it so it does not remove the tags.

 

Thanks in advance.

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.