]>
Commit | Line | Data |
---|---|---|
947f0963 TL |
1 | // IE8 has an odd bug with handling font icons in pseudo elements; |
2 | // it will render the icon once and not update it when something | |
3 | // like text color is changed via style addition or removal. | |
4 | // We have to force icon repaint by adding a style with forced empty | |
5 | // pseudo element content, (x-sync-repaint) and removing it back to work | |
6 | // around this issue. | |
7 | // See this: https://github.com/FortAwesome/Font-Awesome/issues/954 | |
8 | // and this: https://github.com/twbs/bootstrap/issues/13863 | |
9 | Ext.define('Admin.override.menu.Item', { | |
10 | override: 'Ext.menu.Item', | |
11 | ||
12 | compatibility: 'IE@8', // only activate this override on IE8 | |
13 | ||
14 | onFocus: function(e) { | |
15 | this.callParent([e]); | |
16 | this.repaintFontIcons(); | |
17 | }, | |
18 | ||
19 | onFocusLeave: function(e) { | |
20 | this.callParent([e]); | |
21 | this.repaintFontIcons(); | |
22 | }, | |
23 | ||
24 | privates: { | |
25 | repaintFontIcons: function() { | |
26 | var itemEl = this.itemEl, | |
27 | textEl = this.textEl, | |
28 | fly; | |
29 | ||
30 | // This application uses font icons on some elements that the framework | |
31 | // does not expect, so we have to extend its normal IE8 workarounds | |
32 | ||
33 | if (itemEl && this.el.hasCls('font-icon')) { | |
34 | itemEl.syncRepaint(); | |
35 | } | |
36 | ||
37 | if (textEl) { | |
38 | fly = Ext.fly(textEl.dom.firstChild); | |
39 | ||
40 | if (fly && fly.hasCls(Ext.baseCSSPrefix + 'fa')) { | |
41 | fly.syncRepaint(); | |
42 | } | |
43 | } | |
44 | } | |
45 | } | |
46 | }); |