Skip to content

Commit

Permalink
refactor(menu): deprecate main html attribute (#19237)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored and brandyscarney committed Oct 2, 2019
1 parent f4818a1 commit 9688f4d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ export class Menu implements ComponentInterface, MenuI {

const el = this.el;
const parent = el.parentNode as any;
if (this.contentId === undefined) {
console.warn(`[DEPRECATED][ion-menu] Using the [main] attribute is deprecated, please use the "contentId" property instead:
BEFORE:
<ion-menu>...</ion-menu>
<div main>...</div>
AFTER:
<ion-menu contentId="my-content"></ion-menu>
<div id="my-content">...</div>
`);
}
const content = this.contentId !== undefined
? document.getElementById(this.contentId)
: parent && parent.querySelector && parent.querySelector('[main]');
Expand Down
18 changes: 18 additions & 0 deletions core/src/components/split-pane/split-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ export class SplitPane implements ComponentInterface {
}
}

componentWillLoad() {
if (this.contentId === undefined) {
console.warn(`[DEPRECATED][ion-split-pane] Using the [main] attribute is deprecated, please use the "contentId" property instead:
BEFORE:
<ion-split-pane>
...
<div main>...</div>
</ion-split-pane>
AFTER:
<ion-split-pane contentId="main-content">
...
<div id="main-content">...</div>
</ion-split-pane>
`);
}
}

@Watch('disabled')
@Watch('when')
protected updateState() {
Expand Down

0 comments on commit 9688f4d

Please sign in to comment.