@@ -2530,18 +2530,25 @@ <h3><dfn>Writing content</dfn></h3>
2530
2530
throw {{TypeError}} and abort these steps.
2531
2531
</ li >
2532
2532
< li >
2533
- Return `true`;
2533
+ If |context| is `"smart-poster"`, move the < a > URI record</ a > to
2534
+ the beginning of |records|.
2534
2535
</ li >
2535
2536
</ ol >
2537
+ < p class ="note ">
2538
+ Web NFC currently allows writing < a > external type</ a > and
2539
+ < a > local type</ a > records in < a > smart poster</ a > .
2540
+ Also, < a > empty records</ a > are allowed.
2541
+ Applications MAY ignore any extra records inside
2542
+ the < a > smart poster</ a > .
2543
+ </ p >
2536
2544
< p class ="note ">
2537
2545
Icon record media types could be limited to `"image/"` or `"video/"`,
2538
2546
but the [[NDEF-SMARTPOSTER]] specification does actually allow other
2539
2547
media type records in a < a > smart poster</ a > , which can be treated in
2540
2548
an application-specific manner, for instance a vCard contact card
2541
2549
using one of its associated
2542
2550
< a href ="https://www.iana.org/assignments/media-types/media-types.xhtml ">
2543
- MIME types</ a > . Applications MAY ignore any extra records inside
2544
- the < a > smart poster</ a > .
2551
+ MIME types</ a > .
2545
2552
</ p >
2546
2553
</ div >
2547
2554
</ section >
@@ -2574,89 +2581,81 @@ <h3><dfn>Writing content</dfn></h3>
2574
2581
</ ul >
2575
2582
</ li >
2576
2583
< li >
2577
- If |record|'s < a > recordType</ a > starts with a colon `U+003A` (`:`):
2578
- < ul >
2579
- < li >
2580
- If |record| is not a payload to another < a > NDEF record</ a >
2581
- or if |context| is `"smart-poster"`,
2582
- reject |promise| with a {{TypeError}} and abort these steps.
2583
- </ li >
2584
- < li >
2585
- If running the < a > validate local type</ a > steps on |record|'s
2586
- < a > recordType</ a > returns `false`, reject |promise| with a
2587
- {{TypeError}} and abort these steps.
2588
- </ li >
2589
- < li >
2590
- Return the result of running
2591
- < a > map local type to NDEF</ a > given |record| and |ndef|.
2592
- </ li >
2593
- </ ul >
2594
- < li >
2595
- Switching on |record|'s < a > recordType</ a > , invoke one of the
2596
- following algorithms and return the result.
2597
- If the algorithm throws an exception |e|, reject |promise| with |e|
2584
+ Switching on |record|'s < a > recordType</ a > , invoke the algorithm
2585
+ specified below with |record|, |ndef| and |context| and return the
2586
+ result. If an exception |e| is thrown, reject |promise| with |e|
2598
2587
and abort these steps.
2599
2588
< dl >
2600
2589
< dt > "`empty`"</ dt >
2601
2590
< ul >
2602
2591
< li >
2603
- If |context| is `"smart-poster"`,
2604
- [= exception/throw =] a {{TypeError}} and abort these steps.
2605
- </ li >
2606
- < li >
2607
- Return < a > map empty record to NDEF</ a > given |record| and |ndef|.
2592
+ < a > map empty record to NDEF</ a > .
2608
2593
</ li >
2609
2594
</ ul >
2610
2595
< dt > "`text`"</ dt >
2611
2596
< ul >
2612
2597
< li >
2613
- Return < a > map text to NDEF</ a > given |record| and |ndef| .
2598
+ < a > map text to NDEF</ a > .
2614
2599
</ li >
2615
2600
</ ul >
2616
2601
< dt > "`url`"</ dt >
2617
2602
< ul >
2618
2603
< li >
2619
- Return < a > map a URL to NDEF</ a > given |record| and |ndef| .
2604
+ < a > map a URL to NDEF</ a > .
2620
2605
</ li >
2621
2606
</ ul >
2622
2607
< dt > "`mime`"</ dt >
2623
2608
< ul >
2624
2609
< li >
2625
- Return < a > map binary data to NDEF</ a > given |record| and |ndef| .
2610
+ < a > map binary data to NDEF</ a > .
2626
2611
</ li >
2627
2612
</ ul >
2628
2613
< dt > "`smart-poster`"</ dt >
2629
2614
< ul >
2630
2615
< li >
2631
- Return < a > map smart poster to NDEF</ a > given |record|, |ndef|
2632
- and |context|.
2616
+ < a > map smart poster to NDEF</ a > .
2633
2617
</ li >
2634
2618
</ ul >
2635
2619
< dt > "`absolute-url`"</ dt >
2636
2620
< ul >
2637
2621
< li >
2638
- If |context| is `"smart-poster"`,
2639
- [= exception/throw =] a {{TypeError}} and abort these steps.
2640
- </ li >
2641
- < li >
2642
- Return < a > map absolute-URL to NDEF</ a > given |record| and
2643
- |ndef|.
2622
+ < a > map absolute-URL to NDEF</ a > .
2644
2623
</ li >
2645
2624
</ ul >
2646
2625
</ dl >
2647
2626
</ li >
2648
2627
< li >
2649
- If running < a > validate external type</ a > on |record|'s
2650
- < a > recordType</ a > returns `true`,
2651
- < ol >
2628
+ If |record|'s < a > recordType</ a > starts with a colon `U+003A` (`:`):
2629
+ < ul >
2652
2630
< li >
2653
- If |context| is `"smart-poster"`,
2654
- [= exception/throw =] a {{TypeError}} and abort these steps.
2631
+ If |record| is not a payload to another < a > NDEF record</ a >
2632
+ and if |context| is not `"smart-poster"`,
2633
+ reject |promise| with a {{TypeError}} and abort these steps.
2655
2634
</ li >
2656
2635
< li >
2657
- Return < a > map external data to NDEF</ a > given |record| and |ndef|.
2636
+ If running the < a > validate local type</ a > steps on |record|'s
2637
+ < a > recordType</ a > returns `false`, reject |promise| with a
2638
+ {{TypeError}} and abort these steps.
2658
2639
</ li >
2659
- </ ol >
2640
+ <!--
2641
+ TODO: include clauses to fix
2642
+ https://github.com/w3c/web-nfc/issues/546, i.e.
2643
+ check SP size and action records payload size.
2644
+ -->
2645
+ < li >
2646
+ Return the result of running
2647
+ < a > map local type to NDEF</ a > given |record|, |ndef| and
2648
+ |context|. If that throws an exception |e|, reject |promise|
2649
+ with |e| and abort these steps.
2650
+ </ li >
2651
+ </ ul >
2652
+ </ li >
2653
+ < li >
2654
+ If running < a > validate external type</ a > on |record|'s
2655
+ < a > recordType</ a > returns `true`,
2656
+ return < a > map external data to NDEF</ a > given |record|, |ndef| and
2657
+ |context|. If that throws an exception |e|, reject |promise|
2658
+ with |e| and abort these steps.
2660
2659
</ li >
2661
2660
< li >
2662
2661
Otherwise, [= exception/throw =] a {{TypeError}} and abort
@@ -2769,8 +2768,14 @@ <h3><dfn>Writing content</dfn></h3>
2769
2768
< section > < h3 > Mapping empty record to NDEF</ h3 >
2770
2769
< div >
2771
2770
To < dfn > map empty record to NDEF</ dfn > given a |record:NDEFRecordInit|
2772
- and |ndef |, run these steps:
2771
+ |ndef| and |context:string |, run these steps:
2773
2772
< ol class =algorithm data-link-for ="NDEFRecordInit ">
2773
+ <!--
2774
+ <li>
2775
+ If |context| is `"smart-poster"`,
2776
+ [= exception/throw =] a {{TypeError}} and abort these steps.
2777
+ </li>
2778
+ -->
2774
2779
< li >
2775
2780
If |record|'s < a > mediaType</ a > is not `undefined`,
2776
2781
[= exception/throw =] a {{TypeError}} and abort these steps.
@@ -2799,8 +2804,8 @@ <h3><dfn>Writing content</dfn></h3>
2799
2804
2800
2805
< section > < h3 > Mapping string to NDEF</ h3 >
2801
2806
< div >
2802
- To < dfn > map text to NDEF</ dfn > given a |record:NDEFRecordInit| and
2803
- |ndef |, run these steps:
2807
+ To < dfn > map text to NDEF</ dfn > given a |record:NDEFRecordInit|, |ndef|
2808
+ and |context:string |, run these steps:
2804
2809
< p class ="note ">
2805
2810
This is useful when clients specifically want to write text in a
2806
2811
[=well-known type record=].
@@ -2953,8 +2958,8 @@ <h3><dfn>Writing content</dfn></h3>
2953
2958
2954
2959
< section > < h3 > Mapping URL to NDEF</ h3 >
2955
2960
< div >
2956
- To < dfn > map a URL to NDEF</ dfn > given a |record:NDEFRecordInit| and
2957
- |ndef |, run these steps:
2961
+ To < dfn > map a URL to NDEF</ dfn > given a |record:NDEFRecordInit|, |ndef|
2962
+ and |context:string |, run these steps:
2958
2963
< ol class =algorithm data-link-for ="NDEFRecordInit ">
2959
2964
< li >
2960
2965
If |record|'s < a > mediaType</ a > is not `undefined`,
@@ -3039,8 +3044,8 @@ <h3><dfn>Writing content</dfn></h3>
3039
3044
3040
3045
< section > < h3 > Mapping binary data to NDEF</ h3 >
3041
3046
< div >
3042
- To < dfn > map binary data to NDEF</ dfn > given a |record:NDEFRecordInit|
3043
- and |ndef |, run these steps:
3047
+ To < dfn > map binary data to NDEF</ dfn > given a |record:NDEFRecordInit|,
3048
+ |ndef| and |context:string |, run these steps:
3044
3049
< ol class =algorithm data-link-for ="NDEFRecord ">
3045
3050
< li >
3046
3051
If the type of a |record|'s < a > data</ a > is not
@@ -3097,9 +3102,15 @@ <h3><dfn>Writing content</dfn></h3>
3097
3102
3098
3103
< section > < h3 > Mapping external data to NDEF</ h3 >
3099
3104
< div >
3100
- To < dfn > map external data to NDEF</ dfn > given a |record:NDEFRecordInit|
3101
- and |ndef |, run these steps:
3105
+ To < dfn > map external data to NDEF</ dfn > given a |record:NDEFRecordInit|,
3106
+ |ndef| and |context:string |, run these steps:
3102
3107
< ol class =algorithm data-link-for ="NDEFRecordInit ">
3108
+ <!--
3109
+ <li>
3110
+ If |context| is `"smart-poster"`,
3111
+ [= exception/throw =] a {{TypeError}} and abort these steps.
3112
+ </li>
3113
+ -->
3103
3114
< li >
3104
3115
If |record|'s < a > mediaType</ a > is not `undefined`,
3105
3116
[= exception/throw =] a {{TypeError}} and abort these steps.
@@ -3161,8 +3172,8 @@ <h3><dfn>Writing content</dfn></h3>
3161
3172
3162
3173
< section > < h3 > Mapping local type to NDEF</ h3 >
3163
3174
< div >
3164
- To < dfn > map local type to NDEF</ dfn > given a |record:NDEFRecordInit| and
3165
- |ndef|, run these steps:
3175
+ To < dfn > map local type to NDEF</ dfn > given a |record:NDEFRecordInit|,
3176
+ |ndef| and |context:string| , run these steps:
3166
3177
< ol class =algorithm data-link-for ="NDEFRecordInit ">
3167
3178
< li >
3168
3179
If |record|'s < a > mediaType</ a > is not `undefined`,
@@ -3221,6 +3232,10 @@ <h3><dfn>Writing content</dfn></h3>
3221
3232
</ li >
3222
3233
</ ol >
3223
3234
</ li >
3235
+ <!--
3236
+ TODO: clauses to fix https://github.com/w3c/web-nfc/issues/546
3237
+ check SP size and action records payload size.
3238
+ -->
3224
3239
< li >
3225
3240
Return |ndef|.
3226
3241
</ li >
@@ -3231,7 +3246,7 @@ <h3><dfn>Writing content</dfn></h3>
3231
3246
< section > < h3 > Mapping smart poster to NDEF</ h3 >
3232
3247
< div >
3233
3248
To < dfn > map smart poster to NDEF</ dfn > , given a |record:NDEFRecordInit|
3234
- and |ndef |, run these steps:
3249
+ |ndef| and |context:string |, run these steps:
3235
3250
< ol class =algorithm data-link-for ="NDEFRecordInit ">
3236
3251
< li >
3237
3252
If |record|'s < a > mediaType</ a > is not `undefined`,
@@ -3268,8 +3283,16 @@ <h3><dfn>Writing content</dfn></h3>
3268
3283
< section > < h3 > Mapping absolute-URL to NDEF</ h3 >
3269
3284
< div >
3270
3285
To < dfn > map absolute-URL to NDEF</ dfn > given a |record:NDEFRecordInit|
3271
- and |ndef |, run these steps:
3286
+ |ndef| and |context:string |, run these steps:
3272
3287
< ol class =algorithm data-link-for ="NDEFRecord ">
3288
+ < li >
3289
+ If |context| is `"smart-poster"`,
3290
+ [= exception/throw =] a {{TypeError}} and abort these steps.
3291
+ < p class ="note ">
3292
+ The [[NDEF-SMARTPOSTER]] specification allows only one URL in
3293
+ a < a > smart poster</ a > and that MUST be a single < a > URI record</ a > .
3294
+ </ p >
3295
+ </ li >
3273
3296
< li >
3274
3297
If |record|'s < a > mediaType</ a > is not `undefined`,
3275
3298
[= exception/throw =] a {{TypeError}} and abort these steps.
@@ -3708,11 +3731,20 @@ <h3>Parsing content</h3>
3708
3731
</ li >
3709
3732
< li >
3710
3733
If |context| is `"smart-poster"` and |records| contain
3711
- [=absolute-URL records=], remove them rom |records|.
3734
+ [=absolute-URL records=], remove them from |records|.
3735
+ < p class ="note ">
3736
+ In other words, remove [=absolute-URL records=] from < a > smart poster</ a > ,
3737
+ as required by the [[NDEF-SMARTPOSTER]] specification.
3738
+ </ p >
3712
3739
</ li >
3713
3740
< li >
3714
3741
If any record in |records| is a < a > smart poster</ a > , then remove
3715
3742
all < a > URI records</ a > and [=absolute-URL records=] from |records|.
3743
+ < p class ="note ">
3744
+ In other words, remove [=absolute-URL records=] and < a > URI records</ a >
3745
+ from < a > NDEF messages</ a > that contain a < a > smart poster</ a > record,
3746
+ as required by the [[NDEF-SMARTPOSTER]] specification.
3747
+ </ p >
3716
3748
</ li >
3717
3749
< li >
3718
3750
Otherwise return `true`.
0 commit comments