Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* eslint-disable no-extend-native */
- // Dienen geschreven te worden middels function(){} syntax om de correcte "this" te kunnen gebruiken
- // Bij een arrow function zal "this" anders wijzen naar window
- const LoadExtensionMethods = () => {
- Array.prototype.last = function(){
- return this[this.length - 1];
- }
- Element.prototype.getInclusiveHeight = function(extraHeight=0){
- const list = [
- 'margin-top',
- 'margin-bottom',
- 'border-top',
- 'border-bottom',
- 'padding-top',
- 'padding-bottom',
- 'height'
- ]
- const style = window.getComputedStyle(this)
- return list.map(k => parseInt(style.getPropertyValue(k), 10))
- .reduce((prev, cur) => prev + cur)
- + extraHeight;
- }
- }
- export default LoadExtensionMethods;
Advertisement
Add Comment
Please, Sign In to add comment