2.0.2 • Published 10 months ago

@frankhoodbs/w3c-v-cloak-patch v2.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

VCloak Patch Utility

A simple utility to manage Vue's v-cloak directive attribute for an element in the DOM while ensuring HTML validity according to W3C standards.

Description

Vue uses the v-cloak directive to keep an element and its children hidden until its compilation is done. Once compiled, Vue removes the v-cloak attribute, making the element visible.

However, according to W3C standards, custom attributes without the data- prefix are not considered valid in HTML. This is where this utility comes into play.

applyVCloakPatch swaps the non-standard v-cloak with a data-v-cloak attribute to ensure your HTML remains valid according to W3C standards. This utility is useful in scenarios where maintaining a standard-compliant markup is essential while still benefiting from Vue's v-cloak directive.

Usage

  1. Import the utility:
import applyVCloakPatch from '@frankhoodbs/w3c-v-cloak-patch';
  1. Utilize the utility:
// Apply the patch to an element by providing its node ID.
applyVCloakPatch('myNodeId');

For example, for the HTML element:

<div id="myApp" data-v-cloak>
  ...
</div>

By calling applyVCloakPatch('myApp'), the element will transform into:

<div id="myApp" v-cloak>
  ...
</div>

API Reference

applyVCloakPatch(nodeId: string)

  • nodeId (string): The ID of the DOM element to apply the patch.

Upon invocation, this function searches for the element with the provided ID. If the element has the data-v-cloak attribute, it removes it and sets the non-standard v-cloak attribute.

2.0.2

10 months ago

2.0.1

10 months ago

1.2.12

10 months ago

1.2.11

10 months ago

1.2.9

1 year ago

1.2.10

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.1

2 years ago

1.1.2

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.0

2 years ago