Dont serialize the default namespace on ever tag

This commit is contained in:
Kovid Goyal 2019-10-29 15:58:24 +05:30
parent 7687c3dab6
commit cb9b08b369
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 5 deletions

View File

@ -311,7 +311,7 @@ class Serializer {
}
if (!write_str_literal("{\"n\":")) return false;
if (!this->write_string_as_json(tag_name)) return false;
if (nsindex > -1) {
if (nsindex > 0) {
char buf[32];
this->write_data(buf, snprintf(buf, sizeof(buf), ",\"s\":%d", nsindex));
}

View File

@ -252,14 +252,14 @@ class ContentTest(LibraryBaseTest):
bc = data['tree']['c'][1]['c']
self.ae(bc, body_children)
t('<p>a<!--c-->t</p>l', [{"n":"p","s":0,"x":"a","l":"l","c":[{"s":"c","x":"c","l":"t"}]}])
t('<p class="foo" id="bar">a', [{"n":"p","s":0,"x":"a","a":[['class','foo'],['id','bar']]}])
t('<p>a<!--c-->t</p>l', [{"n":"p","x":"a","l":"l","c":[{"s":"c","x":"c","l":"t"}]}])
t('<p class="foo" id="bar">a', [{"n":"p","x":"a","a":[['class','foo'],['id','bar']]}])
t(
'<svg xlink:href="h"></svg>', [{'n': 'svg', 's': 1, 'a': [['href', 'h', 2]]}],
('http://www.w3.org/1999/xhtml', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink')
)
text = '🐈\n\t\\mūs"'
t("<p id='{}'>Peña".format(text), [{"n":"p","s":0,"x":"Peña","a":[['id',text]]}])
t("<p id='{}'>Peña".format(text), [{"n":"p","x":"Peña","a":[['id',text]]}])
text = 'a' * (127 * 1024)
t('<p>{0}<p>{0}'.format(text), [{"n":"p","s":0,"x":text}, {'n':'p','s':0,'x':text}])
t('<p>{0}<p>{0}'.format(text), [{"n":"p","x":text}, {'n':'p','x':text}])
# }}}