module Rails::Dom::Testing::Assertions::SelectorAssertions

def unescape_js(js_string)

Unescapes a JS string.
def unescape_js(js_string)
  # js encodes double quotes and line breaks.
  unescaped= js_string.gsub('\"', '"')
  unescaped.gsub!('\\\'', "'")
  unescaped.gsub!(/\\\//, '/')
  unescaped.gsub!('\n', "\n")
  unescaped.gsub!('\076', '>')
  unescaped.gsub!('\074', '<')
  unescaped.gsub!(/\\\$/, '$')
  unescaped.gsub!(/\\`/, '`')
  # js encodes non-ascii characters.
  unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
  unescaped
end