Ensure API implementations strictly adhere to published specifications, even when adding features or optimizations. Deviating from standard behavior can create compatibility issues with other implementations (like Node.js) that rely on specification-compliant behavior.
Ensure API implementations strictly adhere to published specifications, even when adding features or optimizations. Deviating from standard behavior can create compatibility issues with other implementations (like Node.js) that rely on specification-compliant behavior.
When implementing web APIs:
Example:
// INCORRECT: Adding non-standard behavior directly in core API implementation
void MessagePort::transfer() {
// This behavior differs from spec - ports shouldn't be "closed" on transfer
dispatchCloseEvent();
}
// CORRECT: Follow specification behavior
void MessagePort::transfer() {
detachWithoutClosing(); // Aligns with spec: port is detached but not closed
}
// Alternative for compatibility needs
namespace CompatLayer {
void handleMessagePortTransfer(MessagePort* port) {
// Add Node.js specific behavior here if needed
}
}
Enter the URL of a public GitHub repository