You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When ssml_doc.embed(original_doc) is used to embed one document within another, the original document is left modified unexpectedly. This is exhibited in the following tests: sfgeorge/ruby_speech@539d2cc...bug;destructive-embed
Here's an example using ruby_speech 2.3.1...
require'ruby_speech'original_doc=RubySpeech::SSML.drawdostring"Hi, I'm Fred. The time is currently "say_as:interpret_as=>'date',:format=>'dmy'do"01/02/1960"endendputsoriginal_doc# => <speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">Hi, I'm Fred. The time is currently <say-as interpret-as="date" format="dmy">01/02/1960</say-as></speak>doc2=RubySpeech::SSML.drawdovoice:gender=>:male,:name=>'fred'doembedoriginal_docendendputsoriginal_doc# => <speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">Hi, I'm Fred. The time is currently </speak>
Stepping through this with a debugger, I've found that this issue occurs when embed encounters this line in nokogiri 1.6.1.
...also meant to mention specifically what's happening on this line. Nokogiri is making a few direct modifications to node rather than merely "appending" it into another document:
Activity
sfgeorge commentedon Apr 1, 2014
Updated test cases, to zero-in on the specific problem. Also, confirmed that this is occurring on both CRuby and JRuby.
Stepping through this with a debugger, I've found that this issue occurs when
embedencounters this line in nokogiri 1.6.1.sfgeorge commentedon Apr 1, 2014
...also meant to mention specifically what's happening on this line. Nokogiri is making a few direct modifications to
noderather than merely "appending" it into another document:This can be seen in a debugger session on CRuby:
And afterwards: