docs: refactor strategy docs

pull/3506/head
mehmet-erim 5 years ago
parent cba9c89ff9
commit 97ee0edf4f

@ -50,7 +50,7 @@ Predefined content security strategies are accessible via `CONTENT_SECURITY_STRA
### Loose
```js
Loose(nonce: string)
CONTENT_SECURITY_STRATEGY.Loose(nonce: string)
```
`nonce` will be set.
@ -59,7 +59,7 @@ Loose(nonce: string)
### None
```js
None()
CONTENT_SECURITY_STRATEGY.None()
```
Nothing will be done.

@ -57,7 +57,7 @@ Predefined content strategies are accessible via `CONTENT_STRATEGY` constant.
### AppendScriptToBody
```js
AppendScriptToBody(content: string)
CONTENT_STRATEGY.AppendScriptToBody(content: string)
```
Creates a `<script>` element with the given content and places it at the **end** of `<body>` tag in the document.
@ -66,7 +66,7 @@ Creates a `<script>` element with the given content and places it at the **end**
### AppendScriptToHead
```js
AppendScriptToHead(content: string)
CONTENT_STRATEGY.AppendScriptToHead(content: string)
```
Creates a `<script>` element with the given content and places it at the **end** of `<head>` tag in the document.
@ -75,7 +75,7 @@ Creates a `<script>` element with the given content and places it at the **end**
### AppendStyleToHead
```js
AppendStyleToHead(content: string)
CONTENT_STRATEGY.AppendStyleToHead(content: string)
```
Creates a `<style>` element with the given content and places it at the **end** of `<head>` tag in the document.
@ -84,7 +84,7 @@ Creates a `<style>` element with the given content and places it at the **end**
### PrependStyleToHead
```js
PrependStyleToHead(content: string)
CONTENT_STRATEGY.PrependStyleToHead(content: string)
```
Creates a `<style>` element with the given content and places it at the **beginning** of `<head>` tag in the document.
@ -92,4 +92,4 @@ Creates a `<style>` element with the given content and places it at the **beginn
## See Also
TODO: Place DomInsertionService documentation link here.
- [DomInsertionService](./Dom-Insertion-Service.md)

@ -38,7 +38,7 @@ Predefined cross-origin strategies are accessible via `CROSS_ORIGIN_STRATEGY` co
### Anonymous
```js
Anonymous(integrity?: string)
CROSS_ORIGIN_STRATEGY.Anonymous(integrity?: string)
```
`crossorigin` will be set as `"anonymous"` and `integrity` is optional.
@ -47,7 +47,7 @@ Anonymous(integrity?: string)
### UseCredentials
```js
UseCredentials(integrity?: string)
CROSS_ORIGIN_STRATEGY.UseCredentials(integrity?: string)
```
`crossorigin` will be set as `"use-credentials"` and `integrity` is optional.

@ -34,27 +34,47 @@ This method inserts given `element` to `target` based on the `position`.
Predefined dom strategies are accessible via `DOM_STRATEGY` constant.
### AppendToBody()
### AppendToBody
```js
DOM_STRATEGY.AppendToBody()
```
`insertElement` will place the given `element` at the end of `<body>`.
### AppendToHead()
### AppendToHead
```js
DOM_STRATEGY.AppendToHead()
```
`insertElement` will place the given `element` at the end of `<head>`.
### PrependToHead()
### PrependToHead
```js
DOM_STRATEGY.PrependToHead()
```
`insertElement` will place the given `element` at the beginning of `<head>`.
### AfterElement(target: HTMLElement)
### AfterElement
```js
DOM_STRATEGY.AfterElement(target: HTMLElement)
```
`insertElement` will place the given `element` after (as a sibling to) the `target`.
### BeforeElement(target: HTMLElement)
### BeforeElement
```js
DOM_STRATEGY.BeforeElement(target: HTMLElement)
```
`insertElement` will place the given `element` before (as a sibling to) the `target`.
@ -64,4 +84,6 @@ Predefined dom strategies are accessible via `DOM_STRATEGY` constant.
## See Also
- [DomInsertionService](./Dom-Insertion-Service.md)
- [LazyLoadService](./Lazy-Load-Service.md)
- [LoadingStrategy](./Loading-Strategy.md)
- [ContentStrategy](./Content-Strategy.md)

@ -63,7 +63,7 @@ Predefined content security strategies are accessible via `LOADING_STRATEGY` con
### AppendAnonymousScriptToHead
```js
AppendAnonymousScriptToHead(src: string, integrity?: string)
LOADING_STRATEGY.AppendAnonymousScriptToHead(src: string, integrity?: string)
```
Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<script>` element and places it at the **end** of `<head>` tag in the document.
@ -72,7 +72,7 @@ Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<s
### PrependAnonymousScriptToHead
```js
PrependAnonymousScriptToHead(src: string, integrity?: string)
LOADING_STRATEGY.PrependAnonymousScriptToHead(src: string, integrity?: string)
```
Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<script>` element and places it at the **beginning** of `<head>` tag in the document.
@ -81,7 +81,7 @@ Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<s
### AppendAnonymousScriptToBody
```js
AppendAnonymousScriptToBody(src: string, integrity?: string)
LOADING_STRATEGY.AppendAnonymousScriptToBody(src: string, integrity?: string)
```
Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<script>` element and places it at the **end** of `<body>` tag in the document.
@ -90,7 +90,7 @@ Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<s
### AppendAnonymousStyleToHead
```js
AppendAnonymousStyleToHead(href: string, integrity?: string)
LOADING_STRATEGY.AppendAnonymousStyleToHead(href: string, integrity?: string)
```
Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<style>` element and places it at the **end** of `<head>` tag in the document.
@ -99,7 +99,7 @@ Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<s
### PrependAnonymousStyleToHead
```js
PrependAnonymousStyleToHead(href: string, integrity?: string)
LOADING_STRATEGY.PrependAnonymousStyleToHead(href: string, integrity?: string)
```
Sets given paremeters and `crossorigin="anonymous"` as attributes of created `<style>` element and places it at the **beginning** of `<head>` tag in the document.

Loading…
Cancel
Save