[web-nfc] MimeType references to serialization (#670)

johntalton has just created a new issue for https://github.com/w3c/web-nfc:

== MimeType references to serialization ==
Section [9.15.8](https://w3c.github.io/web-nfc/#parsing-ndef-mime-type-records) Step 2.

`Set record's [mediaType](https://w3c.github.io/web-nfc/#dom-ndefrecord-mediatype) to the result of [serialize a MIME type](https://mimesniff.spec.whatwg.org/#serialize-a-mime-type) with mimeType as the input.`

The seems to refer both to a `mimeType` (assuming that is supposed to be the NDEF typeField as the input) and to the serialization of that data.

Given that we are parsing here, this seems incorrect, regardless. However, [MimeType serialization](https://mimesniff.spec.whatwg.org/#serialize-a-mime-type) seem to expect a `MimeType` object (with type and subtype) ... where the NDEF record is just presenting the `type` field.

In [Example 8](https://w3c.github.io/web-nfc/#example-8) the `record.mediaType` is compared as a `string`, implying that the NDEF `type` should must be assigned to `mediaType` as-is.  (because it was already decode into UTF-8 by [9.15.1 step 9](https://w3c.github.io/web-nfc/#parsing-records-from-bytes)). 

No need to run [MimeType parse](https://mimesniff.spec.whatwg.org/#parsing-a-mime-type) either as that would produce a MimeType object.

There are other reference to serialization of MimeType 9.12.8 which could make more sense, assuming the incoming `record.mediaType` was a `MimeType` object, however, it seems to be set as a `string` in most cases ([Example 10](https://w3c.github.io/web-nfc/#example-10))

If the intention is to support both `USVString|MimeType` as the `mediaType` field of `NDEFRecordInit`, that is unclear. 

apologies if i am reading this wrong 🤷🏻‍♂️, thanks

Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/670 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 16 August 2025 13:41:05 UTC