Comparing version 11.1.0 to 11.2.0
@@ -0,1 +1,7 @@ | ||
### 11.2.0 (2021-01-06) | ||
##### Bug Fixes | ||
* **setTag:** allow for type attribute of element ([8642a3d7](https://github.com/MichaelSolati/ngmeta/commit/8642a3d7c73e4df9ec09ee3016a5794e440f79bc)) | ||
### 11.1.0 (2021-01-06) | ||
@@ -2,0 +8,0 @@ |
import { Title, Meta } from '@angular/platform-browser'; | ||
import { AllMeta, FacebookMeta, GoogleMeta, TagData, TwitterMeta } from './ngmeta.types'; | ||
import { AllMeta, FacebookMeta, GoogleMeta, TagData, TagType, TwitterMeta } from './ngmeta.types'; | ||
import * as i0 from "@angular/core"; | ||
@@ -69,2 +69,3 @@ /** | ||
* Sets a HTML element in the head with any attributes defined in object. | ||
* @param tagType Tag name of HTML Element. | ||
* @param tagData Details for tag to set in head. | ||
@@ -74,3 +75,3 @@ * @param overwrite Whether this method should overwrite an existing instance of the tag. Set to false by default. | ||
*/ | ||
setTag(tagData: TagData, overwrite?: boolean): NgMeta; | ||
setTag(tagType: TagType, tagData: TagData, overwrite?: boolean): NgMeta; | ||
/** | ||
@@ -77,0 +78,0 @@ * Sets document's title shown in a browser's title bar or a page's tab. |
@@ -157,2 +157,3 @@ import { Injectable, Inject } from '@angular/core'; | ||
* Sets a HTML element in the head with any attributes defined in object. | ||
* @param tagType Tag name of HTML Element. | ||
* @param tagData Details for tag to set in head. | ||
@@ -162,7 +163,6 @@ * @param overwrite Whether this method should overwrite an existing instance of the tag. Set to false by default. | ||
*/ | ||
setTag(tagData, overwrite = false) { | ||
tagData.type = tagData.type; | ||
const element = this._dom.createElement(tagData.type); | ||
setTag(tagType, tagData, overwrite = false) { | ||
const element = this._dom.createElement(tagType); | ||
if (overwrite) { | ||
switch (tagData.type) { | ||
switch (tagType) { | ||
case 'base': | ||
@@ -190,6 +190,3 @@ this._meta.removeTag('base'); | ||
const value = tagData[attribute]; | ||
if (attribute === 'type') { | ||
return; | ||
} | ||
else if (['innerHTML', 'innerText', 'textContent'].includes(attribute)) { | ||
if (['innerHTML', 'innerText', 'textContent'].includes(attribute)) { | ||
if (typeof value === 'string') { | ||
@@ -196,0 +193,0 @@ element[attribute] = value; |
@@ -81,6 +81,2 @@ /** | ||
/** | ||
* Tag name of HTML Element. | ||
*/ | ||
type: 'base' | 'link' | 'meta' | 'noscript' | 'script' | 'style'; | ||
/** | ||
* A `DOMString` containing the HTML serialization of the element's descendants. | ||
@@ -103,2 +99,6 @@ */ | ||
/** | ||
* Tag name of HTML Element. | ||
*/ | ||
export declare type TagType = 'base' | 'link' | 'meta' | 'noscript' | 'script' | 'style'; | ||
/** | ||
* Interface for all Twitter microdata meta details in head. | ||
@@ -105,0 +105,0 @@ */ |
{ | ||
"name": "ngmeta", | ||
"version": "11.1.0", | ||
"version": "11.2.0", | ||
"description": "A tool for updating meta tags in an Angular application.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174597
3986