Skip to main content

decode_script_to_vec

Function decode_script_to_vec 

Source
pub fn decode_script_to_vec<S: AsRef<str>>(
    text: S,
    output: &mut Vec<u8>,
) -> &[u8] ⓘ
Expand description

Write text from the <script> element to a mutable Vec<u8> reference and return the decoded data slice.

This appends to output and returns only the new data slice.

The following substring is unescaped:

  • <\/script> => </script>
  • <\!-- => <!--

<\/script at the end of the text is also unescaped. This only removes the listed escapes and does not parse JavaScript. Existing escapes in the original text may also be removed, so encoding and decoding may not return the original text.