Closed
Description
Version
latest main branch
Platform
7.1.4-arch1-1
Subsystem
url
What steps will reproduce the bug?
const { URLPattern } = require('node:url');
const pattern = new URLPattern({ pathname: '/:value' });
const result = pattern.exec('https://example.com/test');
console.log(Object.keys(result));
console.log(Object.keys(result.pathname));
console.log(JSON.stringify(result.pathname));How often does it reproduce? Is there a required condition?
Every
What is the expected behavior? Why is that the expected behavior?
[
'hash',
'hostname',
'pathname',
'port',
'protocol',
'search',
'username'
]
[ 'groups', 'input' ]
'{"groups":{"value":"test"},"input":"/test"}'What do you see instead?
[
'inputs',
'protocol',
'username',
'password',
'hostname',
'port',
'pathname',
'search',
'hash'
]
[ 'input', 'groups' ]
'{"input":"/test","groups":{"value":"test"}}'Additional information
Although direct property access is unaffected, property creation order is observable through:
Object.keys(result);
Object.values(result);
JSON.stringify(result);
({ ...result });This makes Node.js behavior incompatible with browsers and WebIDL dictionary conversion semantics.
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]URLPattern.exec() result properties are not created in WebIDL order[/-][+]url: URLPattern.exec() result properties are not created in WebIDL order[/+]url: create URLPattern result properties in WebIDL order
url: create URLPattern result properties in WebIDL order
url: create URLPattern result properties in WebIDL order
url: create URLPattern result properties in WebIDL order